Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f81b88ae30 | ||
|
|
71b1b933b5 |
@@ -1,3 +1,10 @@
|
||||
## [4.47.1](https://github.com/antialias/soroban-abacus-flashcards/compare/v4.47.0...v4.47.1) (2025-10-20)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
* **hero:** prevent nav thrashing with hysteresis ([71b1b93](https://github.com/antialias/soroban-abacus-flashcards/commit/71b1b933b598c0a6a8aef1bc9f8c598c1871b2eb))
|
||||
|
||||
## [4.47.0](https://github.com/antialias/soroban-abacus-flashcards/compare/v4.46.2...v4.47.0) (2025-10-20)
|
||||
|
||||
|
||||
|
||||
@@ -24,17 +24,31 @@ export function HeroAbacus() {
|
||||
},
|
||||
}
|
||||
|
||||
// Detect when hero scrolls out of view
|
||||
// Detect when hero scrolls out of view with hysteresis to prevent thrashing
|
||||
useEffect(() => {
|
||||
if (!heroRef.current) return
|
||||
|
||||
let currentlyVisible = true // Start as visible (hero starts at top)
|
||||
|
||||
const observer = new IntersectionObserver(
|
||||
([entry]) => {
|
||||
// Hero is visible if more than 20% is in viewport
|
||||
setIsHeroVisible(entry.intersectionRatio > 0.2)
|
||||
// Use hysteresis: different thresholds for showing vs hiding
|
||||
// When scrolling down (becoming invisible): hide when < 10% visible
|
||||
// When scrolling up (becoming visible): show when > 30% visible
|
||||
const ratio = entry.intersectionRatio
|
||||
|
||||
if (currentlyVisible && ratio < 0.1) {
|
||||
// Was visible, now scrolled far enough to hide nav branding
|
||||
currentlyVisible = false
|
||||
setIsHeroVisible(false)
|
||||
} else if (!currentlyVisible && ratio > 0.3) {
|
||||
// Was hidden, now scrolled far enough to show nav branding
|
||||
currentlyVisible = true
|
||||
setIsHeroVisible(true)
|
||||
}
|
||||
},
|
||||
{
|
||||
threshold: [0, 0.2, 0.5, 1],
|
||||
threshold: [0, 0.1, 0.3, 0.5, 1],
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "soroban-monorepo",
|
||||
"version": "4.47.0",
|
||||
"version": "4.47.1",
|
||||
"private": true,
|
||||
"description": "Beautiful Soroban Flashcard Generator - Monorepo",
|
||||
"workspaces": [
|
||||
|
||||
Reference in New Issue
Block a user