Adds hero component

This commit is contained in:
2026-10-11 18:35:24 +02:00
parent ce4aeb7e9c
commit ebcb1f7729
13 changed files with 214 additions and 44 deletions
+14
View File
@@ -0,0 +1,14 @@
import { useEffect, useState } from 'react';
export default function useScrolledPast(getThreshold: () => number) {
const [scrolled, setScrolled] = useState(false);
useEffect(() => {
const onScroll = () => setScrolled(window.scrollY > getThreshold());
onScroll();
window.addEventListener('scroll', onScroll, { passive: true });
return () => window.removeEventListener('scroll', onScroll);
}, [getThreshold]);
return scrolled;
}