UI Library for Design Engineers. Animated components and effects you can copy and paste into your apps. Free. Open Source.
fix: update header window fix
Dillion Verma539d4ed2b1f7
diff --git a/registry/blocks/example/header-1.tsx b/registry/blocks/example/header-1.tsxindex 262e818e..88d3e55a 100644--- a/registry/blocks/example/header-1.tsx+++ b/registry/blocks/example/header-1.tsx@@ -22,16 +22,23 @@ export default function StickyHeader() {return "2xl";};- const [breakpoint, setBreakpoint] = useState(() =>- getBreakpoint(window.innerWidth),- );+ const [breakpoint, setBreakpoint] = useState("xl"); // Default to 'xl' or any other default valueuseEffect(() => {- const updateBreakpoint = () =>+ // This function will only run in the client-side environment+ const handleResize = () => {setBreakpoint(getBreakpoint(window.innerWidth));- window.addEventListener("resize", updateBreakpoint);- return () => window.removeEventListener("resize", updateBreakpoint);- }, []);+ };++ // Set the initial value when the component mounts+ handleResize();++ // Optionally, update the breakpoint on window resize+ window.addEventListener("resize", handleResize);++ // Cleanup the event listener when the component unmounts+ return () => window.removeEventListener("resize", handleResize);+ }, []); // Empty dependency array ensures this effect runs only once on mountconst active =scrollY >= SCROLL_BOUNDARY ||