Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/Layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ export function Layout({ children, title, tableOfContents }) {
className="relative mx-auto flex max-w-8xl sm:px-2 lg:px-8 xl:px-12 lg:ml-72 xl:ml-80"
style={{ paddingTop: bannerHeight }}
>
<motion.header
layoutScroll
<header
// layoutScroll
className="contents lg:pointer-events-none lg:fixed lg:inset-0 lg:z-40 lg:flex"
style={{ top: bannerHeight }}
>
Expand All @@ -192,7 +192,7 @@ export function Layout({ children, title, tableOfContents }) {
<Header />
{router.route.startsWith("/ipa") ? <NavigationAPI className="hidden lg:mt-10 lg:block" tableOfContents={tableOfContents} /> : <NavigationDocs className="hidden lg:mt-10 lg:block" />}
</div>
</motion.header>
</header>
<div className="min-w-0 max-w-2xl flex-auto px-4 py-16 lg:max-w-none lg:pl-8 lg:pr-0 xl:px-5">
<main className="py-16">
<Prose as="article">{children}</Prose>
Expand Down
12 changes: 6 additions & 6 deletions src/components/NavigationAPI.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export function NavLink({ href, tag, active, isAnchorLink = false, children, lin
{links &&
<ul role="list">
{links.map((link,index) => (
<motion.li key={index} layout="position" className="relative">
<motion.li key={index} className="relative">
<NavLink href={link.href} active={link.href === router.pathname} isChildren={true}>
{link.title}
</NavLink>
Expand Down Expand Up @@ -146,7 +146,7 @@ export function VisibleSectionHighlight() {

return activeIndex >= 0 && (
<motion.div
layout
// layout
initial={{ opacity: 0 }}
animate={{ opacity: 1, transition: { delay: 0.2 } }}
exit={{ opacity: 0 }}
Expand All @@ -169,7 +169,7 @@ export function ActivePageMarker() {

return activeIndex >= 0 && (
<motion.div
layout
// layout
className="absolute left-2 h-6 w-px bg-orange-500"
initial={{ opacity: 0 }}
animate={{ opacity: 1, transition: { delay: 0.2 } }}
Expand All @@ -187,7 +187,7 @@ function NavigationGroup({ group, className, tableOfContents }) {
return (
<li className={clsx('relative mt-6', className)}>
<motion.h2
layout="position"
// layout="position"
data-nb-link={group.title}
className="text-xs font-semibold text-zinc-900 dark:text-white"
>
Expand All @@ -200,7 +200,7 @@ function NavigationGroup({ group, className, tableOfContents }) {
)}
</AnimatePresence>
<motion.div
layout
// layout
className="absolute inset-y-0 left-2 w-px bg-zinc-900/10 dark:bg-white/5"
/>
<AnimatePresence initial={false}>
Expand All @@ -210,7 +210,7 @@ function NavigationGroup({ group, className, tableOfContents }) {
</AnimatePresence>
<ul role="list" className="border-l border-transparent">
{group.links.map((link) => (
<motion.li key={link.href} layout="position" className="relative">
<motion.li key={link.href} className="relative">
<NavLink href={link.href} active={link.href === router.pathname.replace("ipa", "api")}>
{link.title}
</NavLink>
Expand Down
6 changes: 3 additions & 3 deletions src/components/NavigationDocs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ export const docsNavigation = [
return (
<li className={clsx('relative', className, hasChildren ? "" : "mt-6")}>
<motion.h2
layout={"size"}
// layout={"size"}
className={clsx(
"flex justify-between items-center gap-2 group",
hasChildren ? "text-zinc-700 select-none py-1 pr-3 hover:text-zinc-900 dark:text-zinc-300 font-medium dark:hover:text-white text-sm cursor-pointer" : "text-xs font-semibold text-zinc-900 dark:text-white"
Expand Down Expand Up @@ -399,7 +399,7 @@ export const docsNavigation = [
)}
</AnimatePresence>
<motion.div
layout
// layout
className="absolute inset-y-0 left-2 w-px bg-zinc-900/10 dark:bg-white/5"
/>
<AnimatePresence initial={false}>
Expand All @@ -426,7 +426,7 @@ export const docsNavigation = [
className="border-l border-transparent">
{group.links.map((link) => {
return link.href ?
<motion.li key={link.href} layout={"position"} className="relative">
<motion.li key={link.href} className="relative">
<NavLink href={link.href} active={link.href === router.pathname} links={link.links}>
{link.title}
</NavLink>
Expand Down
26 changes: 13 additions & 13 deletions src/components/announcement-banner/AnnouncementBannerProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand All @@ -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)
Expand All @@ -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) {
Expand Down