Refactor layout and navigation components to remove unused motion props (#494)

- Replaced motion.header with a standard header in Layout component.
- Removed layout props from motion elements in NavigationAPI and NavigationDocs components for improved performance and clarity.
- Updated AnnouncementBannerProvider to make the banner always visible, removing scroll-based hiding logic.
This commit is contained in:
Brandon Hopkins
2025-11-25 11:03:25 -08:00
committed by GitHub
parent fb4b060710
commit cc0b4cd01b
4 changed files with 25 additions and 25 deletions

View File

@@ -35,7 +35,6 @@ export function AnnouncementBannerProvider({ children }) {
undefined
)
let announcementId = announcement.text
let [isHiddenByScroll, setIsHiddenByScroll] = useState(false)
let [bannerHeight, setBannerHeight] = useState(0)
let close = () => {
@@ -48,7 +47,7 @@ export function AnnouncementBannerProvider({ children }) {
return closedAnnouncement !== announcementId
}, [announcementId, closedAnnouncement, mounted])
let isVisible = isActive && !isHiddenByScroll
let isVisible = isActive // Always visible when active, regardless of scroll
let reportHeight = useCallback((height) => {
setBannerHeight(height)
@@ -59,19 +58,20 @@ export function AnnouncementBannerProvider({ children }) {
return () => setMounted(false)
}, [])
useEffect(() => {
if (typeof window === 'undefined') {
return
}
// Removed scroll-based hiding to make banner always sticky
// useEffect(() => {
// if (typeof window === 'undefined') {
// return
// }
function handleScroll() {
setIsHiddenByScroll(window.scrollY > 30)
}
// function handleScroll() {
// setIsHiddenByScroll(window.scrollY > 30)
// }
handleScroll()
window.addEventListener('scroll', handleScroll, { passive: true })
return () => window.removeEventListener('scroll', handleScroll)
}, [])
// handleScroll()
// window.addEventListener('scroll', handleScroll, { passive: true })
// return () => window.removeEventListener('scroll', handleScroll)
// }, [])
useEffect(() => {
if (!isVisible && bannerHeight !== 0) {