Skip to content

The Open Standard for Generative UI

fix(docs): show mobile section tabs (#843)

rahuldovalfd01d01ac78b
diff --git a/docs/app/global.css b/docs/app/global.css
index ac4955f41..109d40605 100644
--- a/docs/app/global.css
+++ b/docs/app/global.css
@@ -147,8 +147,8 @@ body {
@media (max-width: 767px) {
#nd-docs-layout {
- --fd-banner-height: 4rem !important;
- min-height: calc(100dvh - 4rem) !important;
- padding-top: 4rem !important;
+ --fd-banner-height: calc(4rem + 2.5rem) !important;
+ min-height: calc(100dvh - (4rem + 2.5rem)) !important;
+ padding-top: calc(4rem + 2.5rem) !important;
}
}
diff --git a/docs/components/docs-navbar.module.css b/docs/components/docs-navbar.module.css
index 9c1872ab7..bfc5df80c 100644
--- a/docs/components/docs-navbar.module.css
+++ b/docs/components/docs-navbar.module.css
@@ -215,6 +215,30 @@
}
.tabsBar {
- display: none;
+ padding-top: 0;
+ border-top: 1px solid var(--openui-border-default);
+ }
+
+ .tabsInner {
+ min-height: 2.5rem;
+ padding-inline: 0;
+ }
+
+ .tabsNav {
+ box-sizing: border-box;
+ min-height: 2.5rem;
+ gap: 0.625rem;
+ padding-inline: 0.5rem;
+ border-bottom: 1px solid var(--openui-border-default);
+ overflow-x: auto;
+ overscroll-behavior-x: contain;
+ -webkit-overflow-scrolling: touch;
+ }
+
+ .tabLink {
+ min-height: 2.5rem;
+ padding: 0.5rem 0;
+ font-size: 0.8125rem;
+ line-height: 1.5rem;
}
}
diff --git a/docs/components/docs-navbar.tsx b/docs/components/docs-navbar.tsx
index 424f741dc..72e775be8 100644
--- a/docs/components/docs-navbar.tsx
+++ b/docs/components/docs-navbar.tsx
@@ -38,7 +38,10 @@ function SearchBar() {
const [isMac, setIsMac] = useState(false);
useEffect(() => {
- setIsMac(/mac/i.test(navigator.userAgent));
+ let cancelled = false;
+ queueMicrotask(() => {
+ if (!cancelled) setIsMac(/mac/i.test(navigator.userAgent));
+ });
const handler = (e: KeyboardEvent) => {
if ((e.metaKey || e.ctrlKey) && e.key === "k") {
@@ -47,7 +50,10 @@ function SearchBar() {
}
};
window.addEventListener("keydown", handler);
- return () => window.removeEventListener("keydown", handler);
+ return () => {
+ cancelled = true;
+ window.removeEventListener("keydown", handler);
+ };
}, [setOpenSearch]);
return (
@@ -87,7 +93,15 @@ export function DocsNavbar({ showSidebarToggle = false }: { showSidebarToggle?:
// theme-derived variant behind a mount flag (matching SiteMarketingHeader) to
// avoid a hydration mismatch on the brand text color.
const [mounted, setMounted] = useState(false);
- useEffect(() => setMounted(true), []);
+ useEffect(() => {
+ let cancelled = false;
+ queueMicrotask(() => {
+ if (!cancelled) setMounted(true);
+ });
+ return () => {
+ cancelled = true;
+ };
+ }, []);
const logoVariant = mounted && resolvedTheme === "dark" ? "dark" : "light";
const tabValue = useMemo(() => activeTabUrl(pathname), [pathname]);