From fc8f1fc5c125d69b3b449364ddd70d921d59dea1 Mon Sep 17 00:00:00 2001 From: Mohit Sapat Date: Tue, 20 Oct 2026 01:32:39 +0530 Subject: [PATCH] fix(navbar): drop the Babelize default for githubUrl and accept owner/repo shorthand showGitHub alone linked to this library's own repository. It now renders no button and warns, and githubUrl accepts "owner" or "owner/repo". --- content/docs/components/navigation/navbar.mdx | 52 ++++++++++++------- content/docs/customization/interfaces.mdx | 4 +- src/components/docs/navbar-demo.tsx | 1 + src/registry/components/navbar.tsx | 42 ++++++++++++--- test/navbar.test.tsx | 28 ++++++++++ 5 files changed, 99 insertions(+), 28 deletions(-) diff --git a/content/docs/components/navigation/navbar.mdx b/content/docs/components/navigation/navbar.mdx index 0be88ce..ce8bfb1 100644 --- a/content/docs/components/navigation/navbar.mdx +++ b/content/docs/components/navigation/navbar.mdx @@ -112,6 +112,7 @@ export function SiteNav() { onValueChange={setLocale} cta={{ label: "Get Started", href: "/signup" }} showGitHub + githubUrl="your-org/your-repo" // or a full URL /> ); } @@ -119,25 +120,25 @@ export function SiteNav() { ## Props -| Prop | Type | Required | Description | -| --------------- | --------------------------------- | -------- | ---------------------------------------------------------------- | -| `logo` | `React.ReactNode` | No | Logo element (renders before nav links) | -| `links` | `NavLink[]` | No | Navigation links | -| `activeHref` | `string` | No | `href` of the current page — gets `aria-current` and a highlight | -| `locales` | `Locale[]` | No | Available locales for language selector | -| `value` | `string` | No | Selected locale code — pass this to control the component | -| `defaultValue` | `string` | No | Initial locale code when uncontrolled (default: first locale) | -| `onValueChange` | `(code: string) => void` | No | Callback when locale changes | -| `cta` | `{ label: string; href: string }` | No | CTA button | -| `showGitHub` | `boolean` | No | Show GitHub icon button | -| `githubUrl` | `string` | No | GitHub repository URL | -| `sticky` | `boolean` | No | Make navbar sticky at top (default: `true`) | -| `variant` | `"default" \| "floating"` | No | Full-width bar or inset floating card (default: `"default"`) | -| `showFlags` | `boolean` | No | Show flags in language selector (default: `true`) | -| `maxHeight` | `number \| string` | No | Max height of the scrolling language menu (default: `"15rem"`) | -| `linkComponent` | `React.ElementType` | No | Component used for internal links (default: `"a"`) | -| `classNames` | `NavBarClassNames` | No | Per-part class overrides (see below) | -| `className` | `string` | No | Additional CSS classes | +| Prop | Type | Required | Description | +| --------------- | --------------------------------- | -------- | ----------------------------------------------------------------------------- | +| `logo` | `React.ReactNode` | No | Logo element (renders before nav links) | +| `links` | `NavLink[]` | No | Navigation links | +| `activeHref` | `string` | No | `href` of the current page — gets `aria-current` and a highlight | +| `locales` | `Locale[]` | No | Available locales for language selector | +| `value` | `string` | No | Selected locale code — pass this to control the component | +| `defaultValue` | `string` | No | Initial locale code when uncontrolled (default: first locale) | +| `onValueChange` | `(code: string) => void` | No | Callback when locale changes | +| `cta` | `{ label: string; href: string }` | No | CTA button | +| `showGitHub` | `boolean` | No | Show the GitHub icon button. Needs `githubUrl` — without one, nothing renders | +| `githubUrl` | `string` | No | Full URL, or `"owner"` / `"owner/repo"` shorthand for github.com | +| `sticky` | `boolean` | No | Make navbar sticky at top (default: `true`) | +| `variant` | `"default" \| "floating"` | No | Full-width bar or inset floating card (default: `"default"`) | +| `showFlags` | `boolean` | No | Show flags in language selector (default: `true`) | +| `maxHeight` | `number \| string` | No | Max height of the scrolling language menu (default: `"15rem"`) | +| `linkComponent` | `React.ElementType` | No | Component used for internal links (default: `"a"`) | +| `classNames` | `NavBarClassNames` | No | Per-part class overrides (see below) | +| `className` | `string` | No | Additional CSS classes | Any other prop is spread onto the underlying `