diff --git a/lib/experimental/Navigation/Sidebar/Sidebar.tsx b/lib/experimental/Navigation/Sidebar/Sidebar.tsx index d3ce6e78f..1aef760b7 100644 --- a/lib/experimental/Navigation/Sidebar/Sidebar.tsx +++ b/lib/experimental/Navigation/Sidebar/Sidebar.tsx @@ -1,9 +1,33 @@ import { useReducedMotion } from "@/lib/a11y" import { cn } from "@/lib/utils" import { AnimatePresence, motion } from "framer-motion" -import { ReactNode, useState } from "react" +import { ReactNode } from "react" +import { useIntersectionObserver } from "usehooks-ts" import { useSidebar } from "../ApplicationFrame/FrameProvider" +const ScrollShadow = ({ position }: { position: "top" | "bottom" }) => ( + +) + interface SidebarProps { header?: ReactNode body?: ReactNode @@ -13,11 +37,9 @@ interface SidebarProps { export function Sidebar({ header, body, footer }: SidebarProps) { const { sidebarState, isSmallScreen } = useSidebar() const shouldReduceMotion = useReducedMotion() - const [isScrolled, setIsScrolled] = useState(false) - const handleScroll = (e: React.UIEvent) => { - setIsScrolled(e.currentTarget.scrollTop > 0) - } + const [topRef, isAtTop] = useIntersectionObserver({ threshold: 1 }) + const [bottomRef, isAtBottom] = useIntersectionObserver({ threshold: 1 }) const transition = { x: { @@ -66,24 +88,16 @@ export function Sidebar({ header, body, footer }: SidebarProps) {
{header}
{body && (
- - {isScrolled && ( - - )} - -
+
+ )}
{footer}
diff --git a/lib/experimental/Navigation/Sidebar/User/index.tsx b/lib/experimental/Navigation/Sidebar/User/index.tsx index 63ca9aab0..360e00aaa 100644 --- a/lib/experimental/Navigation/Sidebar/User/index.tsx +++ b/lib/experimental/Navigation/Sidebar/User/index.tsx @@ -18,7 +18,7 @@ interface UserProps { export function User({ firstName, lastName, avatarUrl, options }: UserProps) { return ( -
+