mirror of
https://github.com/netbirdio/docs.git
synced 2026-04-19 08:56:35 +00:00
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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user