-
Notifications
You must be signed in to change notification settings - Fork 3
Open
Description
One way to do it:
- Create a new file called FooterWrapper.tsx inside src/components/layout/.
- Do NOT change Footer.tsx
- In the /src/components/layout/index.tsx where we currently have Footer , replace it with FooterWrapper so the wrapper controls when the footer appears.
What to do in the wrapper:
- Create a state variable that starts as false (footer hidden). (using useState)
- Add a scroll listener using useEffect that checks window.scrollY.
- Add a check that makes the footer visible once window.scrollY passes a small threshold (around 100px), so it only appears after the user starts scrolling.
- When the state is true, show the footer; when false, hide it.
- Wrap the inside a div whose CSS classes depend on that state (opacity 0 when hidden, opacity 100 when visible).
Metadata
Metadata
Assignees
Labels
No labels