Spaces:
Paused
Paused
Download components/shared/header/Wrapper/Wrapper.tsx from Leon4gr45/paper2code-cli: direct link, hf CLI and curl.
- Browser
- Download file 931 Bytes
-
https://huggingface.co/spaces/Leon4gr45/paper2code-cli/resolve/main/components/shared/header/Wrapper/Wrapper.tsx
- Command line
-
hf download hf://spaces/Leon4gr45/paper2code-cli/components/shared/header/Wrapper/Wrapper.tsx
-
curl -L -o Wrapper.tsx https://huggingface.co/spaces/Leon4gr45/paper2code-cli/resolve/main/components/shared/header/Wrapper/Wrapper.tsx
931 Bytes
| "use client"; | |
| import { usePathname } from "next/navigation"; | |
| import { useEffect, useState } from "react"; | |
| import { cn } from "@/utils/cn"; | |
| export default function HeaderWrapper({ | |
| children, | |
| }: { | |
| children: React.ReactNode; | |
| }) { | |
| const [shouldShrink, setShouldShrink] = useState(false); | |
| const pathname = usePathname(); | |
| useEffect(() => { | |
| const heroContentHeight = | |
| document.getElementById("hero-content")?.clientHeight; | |
| const triggerTop = heroContentHeight ? heroContentHeight : 100; | |
| const onScroll = () => { | |
| setShouldShrink(window.scrollY > triggerTop); | |
| }; | |
| onScroll(); | |
| window.addEventListener("scroll", onScroll); | |
| }, [pathname]); | |
| return ( | |
| <div | |
| className={cn( | |
| "container lg:px-56 px-16 flex justify-between transition-[padding] duration-[200ms] items-center", | |
| shouldShrink ? "py-20" : "py-20 lg:py-34", | |
| )} | |
| > | |
| {children} | |
| </div> | |
| ); | |
| } | |