From a072668326ac00f262cb4c320adfc370c0c91a65 Mon Sep 17 00:00:00 2001 From: Emile Fugulin Date: Fri, 13 Feb 2026 13:36:31 -0500 Subject: [PATCH 1/2] Make navbar mobile friendly --- .vitepress/components/NavItem.vue | 168 ++++++++++++++++++++++++++++++ .vitepress/components/Navbar.vue | 7 ++ .vitepress/config.mts | 32 ++++-- .vitepress/navbars/app.ts | 2 +- .vitepress/navbars/dashboard.ts | 2 +- .vitepress/theme/Layout.vue | 14 ++- .vitepress/theme/index.ts | 4 +- 7 files changed, 215 insertions(+), 14 deletions(-) create mode 100644 .vitepress/components/NavItem.vue diff --git a/.vitepress/components/NavItem.vue b/.vitepress/components/NavItem.vue new file mode 100644 index 00000000..d7b1b7f9 --- /dev/null +++ b/.vitepress/components/NavItem.vue @@ -0,0 +1,168 @@ + + + + + diff --git a/.vitepress/components/Navbar.vue b/.vitepress/components/Navbar.vue index 0e86f1ff..6def1572 100644 --- a/.vitepress/components/Navbar.vue +++ b/.vitepress/components/Navbar.vue @@ -89,6 +89,13 @@ const isActive = (link: string) => { border-bottom-color: var(--vp-c-brand-1); } +/* Hide second navbar on mobile; section links are in the hamburger menu */ +@media (max-width: 960px) { + .second-navbar { + display: none; + } +} + @media (max-width: 768px) { .second-navbar-container { padding: 8px 16px; diff --git a/.vitepress/config.mts b/.vitepress/config.mts index 37674b45..8b28779f 100644 --- a/.vitepress/config.mts +++ b/.vitepress/config.mts @@ -4,10 +4,8 @@ import llmstxt from "vitepress-plugin-llms"; import type { DefaultTheme } from "vitepress"; import MermaidExample from "./mermaid"; -import { - appSidebars, - dashboardSidebars, -} from "./sidebars"; +import { appNavbar, dashboardNavbar } from "./navbars"; +import { appSidebars, dashboardSidebars } from "./sidebars"; // https://vitepress.dev/reference/site-config export default defineConfig({ @@ -63,12 +61,28 @@ export default defineConfig({ nav: [ { - text: "Application", - link: "/app/quickstart/", - activeMatch: "^/app(/.*)?$", + component: "NavItem", + props: { + text: "Application", + link: "/app/quickstart/", + activeMatch: "^/app(/.*)?$", + items: appNavbar, + }, + }, + { + component: "NavItem", + props: { + text: "Dashboard", + link: "/dashboard/quickstart/", + activeMatch: "^/dashboard(/|$)", + items: dashboardNavbar, + }, + }, + { + text: "FAQ", + link: "/faq", + activeMatch: "^/faq(/|$)", }, - { text: "Dashboard", link: "/dashboard/quickstart/", activeMatch: "^/dashboard(/|$)" }, - { text: "FAQ", link: "/faq", activeMatch: "^/faq(/|$)" }, ] satisfies DefaultTheme.NavItem[], sidebar: { diff --git a/.vitepress/navbars/app.ts b/.vitepress/navbars/app.ts index 96e7a09e..53e2ebd2 100644 --- a/.vitepress/navbars/app.ts +++ b/.vitepress/navbars/app.ts @@ -1,6 +1,6 @@ import type { DefaultTheme } from "vitepress"; -export const appNavbar: DefaultTheme.NavItem[] = [ +export const appNavbar: DefaultTheme.NavItemWithLink[] = [ { text: "Get Started", link: "/app/quickstart/" }, { text: "How-to Guides", link: "/app/guides/" }, { text: "Tutorials", link: "/app/tutorials/" }, diff --git a/.vitepress/navbars/dashboard.ts b/.vitepress/navbars/dashboard.ts index fada4179..1cc2a41b 100644 --- a/.vitepress/navbars/dashboard.ts +++ b/.vitepress/navbars/dashboard.ts @@ -1,6 +1,6 @@ import type { DefaultTheme } from "vitepress"; -export const dashboardNavbar: DefaultTheme.NavItem[] = [ +export const dashboardNavbar: DefaultTheme.NavItemWithLink[] = [ { text: "Get Started", link: "/dashboard/quickstart/" }, { text: "Guides", link: "/dashboard/guides/" }, { text: "Concepts", link: "/dashboard/concepts/" }, diff --git a/.vitepress/theme/Layout.vue b/.vitepress/theme/Layout.vue index 969d3b71..6fc2f9ad 100644 --- a/.vitepress/theme/Layout.vue +++ b/.vitepress/theme/Layout.vue @@ -12,15 +12,25 @@ const { Layout } = DefaultThemeComponent;