diff --git a/sites/docs/astro.config.mjs b/sites/docs/astro.config.mjs index a4122dea..e8208c10 100644 --- a/sites/docs/astro.config.mjs +++ b/sites/docs/astro.config.mjs @@ -126,6 +126,7 @@ export default defineConfig({ Header: './src/components/Header.astro', LanguageSelect: './src/components/LanguageSelect.astro', MarkdownContent: './src/components/MarkdownContent.astro', + Sidebar: './src/components/Sidebar.astro', SiteTitle: './src/components/SiteTitle.astro', PageFrame: './src/components/PageFrame.astro', }, diff --git a/sites/docs/src/components/ProductNav.astro b/sites/docs/src/components/ProductNav.astro new file mode 100644 index 00000000..78fdb08e --- /dev/null +++ b/sites/docs/src/components/ProductNav.astro @@ -0,0 +1,78 @@ +--- +import { t } from '../config/strings'; +import { productNav } from '../lib/versions'; + +interface Props { + variant: 'header' | 'sidebar'; +} + +const meta = Astro.locals.starlightRoute.entry.data.gitea; +const strings = t(meta?.locale ?? 'en-us'); +const products = productNav(meta); +const { variant } = Astro.props; +--- + + + + diff --git a/sites/docs/src/components/Sidebar.astro b/sites/docs/src/components/Sidebar.astro new file mode 100644 index 00000000..0afbcf05 --- /dev/null +++ b/sites/docs/src/components/Sidebar.astro @@ -0,0 +1,13 @@ +--- +import Default from '@astrojs/starlight/components/Sidebar.astro'; +import ProductNav from './ProductNav.astro'; + +/** + * The product navigation is hidden from the header until the 72rem layout + * breakpoint, so it is rendered at the top of the sidebar for the layouts in + * between (and for the mobile menu below 50rem). + */ +--- + + + diff --git a/sites/docs/src/components/SiteTitle.astro b/sites/docs/src/components/SiteTitle.astro index 32fd487e..be25338a 100644 --- a/sites/docs/src/components/SiteTitle.astro +++ b/sites/docs/src/components/SiteTitle.astro @@ -1,29 +1,17 @@ --- import Default from '@astrojs/starlight/components/SiteTitle.astro'; -import { t } from '../config/strings'; -import { productNav } from '../lib/versions'; +import ProductNav from './ProductNav.astro'; /** * The starlight header has no navigation links, the gitea site needs the four * products next to the logo. Rendered next to the site title so the rest of the * header (search, theme, pickers) keeps working untouched. */ -const meta = Astro.locals.starlightRoute.entry.data.gitea; -const strings = t(meta?.locale ?? 'en-us'); -const products = productNav(meta); ---
- +