-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed user menu #958
Fixed user menu #958
Conversation
🔍 Visual review for your branch is published 🔍Here are the links to: |
useEffect(() => { | ||
const observerOptions = { threshold: [1] } | ||
|
||
const createObserver = (callback: (isIntersecting: boolean) => void) => { | ||
return new IntersectionObserver( | ||
([entry]) => callback(!entry.isIntersecting), | ||
observerOptions | ||
) | ||
} | ||
|
||
const topObserver = createObserver(setIsScrolled) | ||
const bottomObserver = createObserver(setHasScrollBottom) | ||
|
||
if (topScrollDetectorRef.current) { | ||
topObserver.observe(topScrollDetectorRef.current) | ||
} | ||
if (bottomScrollDetectorRef.current) { | ||
bottomObserver.observe(bottomScrollDetectorRef.current) | ||
} | ||
|
||
return () => { | ||
topObserver.disconnect() | ||
bottomObserver.disconnect() | ||
} | ||
}, []) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! But - you have this fantastic tool at your disposal useIntersectionObserver
. It's in the usehooks-ts
dependency 😉
https://usehooks-ts.com/react-hook/use-intersection-observer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah right, thanks! That makes it a lot easier, haha :D
<AnimatePresence> | ||
{isScrolled && <ScrollShadow position="top" />} | ||
</AnimatePresence> | ||
|
||
<AnimatePresence> | ||
{hasScrollBottom && <ScrollShadow position="bottom" />} | ||
</AnimatePresence> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Awesome work!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's go!
Description
Fixes the User menu to the bottom of the Sidebar, and adds a gradient style like the one we already have for scrolling the header.
This also requires to update Factorial to use the footer prop for the user menu in the Sidebar. I'll do it next.
Related: JIRA
Screenshots
Screen.Recording.2024-12-11.at.09.58.48.mov
Type of Change