diff --git a/docs/astro.config.mjs b/docs/astro.config.mjs index 3d8764d3b..b428a280b 100644 --- a/docs/astro.config.mjs +++ b/docs/astro.config.mjs @@ -75,6 +75,8 @@ export default defineConfig({ ], components: { MarkdownContent: './src/components/MarkdownContent.astro', + Header: './src/components/Header.astro', + MobileMenuFooter: './src/components/MobileMenuFooter.astro' }, }), ], diff --git a/docs/src/components/Header.astro b/docs/src/components/Header.astro new file mode 100644 index 000000000..48a005fd0 --- /dev/null +++ b/docs/src/components/Header.astro @@ -0,0 +1,87 @@ +--- +import config from 'virtual:starlight/user-config' +import type { Props } from '@astrojs/starlight/props' + +import LanguageSelect from 'virtual:starlight/components/LanguageSelect' +import Search from 'virtual:starlight/components/Search' +import SiteTitle from 'virtual:starlight/components/SiteTitle' +import SocialIcons from 'virtual:starlight/components/SocialIcons' +import ThemeSelect from 'virtual:starlight/components/ThemeSelect' + +import VersionSelector from './VersionSelector.astro' + +/** + * Render the `Search` component if Pagefind is enabled or the default search component has been overridden. + */ +const shouldRenderSearch = config.pagefind || config.components.Search !== '@astrojs/starlight/components/Search.astro' +--- + +
+
+ +
+
+ {shouldRenderSearch && } +
+
+ + + + +
+
+ + diff --git a/docs/src/components/MobileMenuFooter.astro b/docs/src/components/MobileMenuFooter.astro new file mode 100644 index 000000000..be07a726a --- /dev/null +++ b/docs/src/components/MobileMenuFooter.astro @@ -0,0 +1,35 @@ +--- +import LanguageSelect from 'virtual:starlight/components/LanguageSelect' +import SocialIcons from 'virtual:starlight/components/SocialIcons' +import ThemeSelect from 'virtual:starlight/components/ThemeSelect' +import type { Props } from '@astrojs/starlight/props' +import VersionSelector from './VersionSelector.astro' +--- + +
+
+ +
+ + + +
+ + diff --git a/docs/src/components/VersionSelector.astro b/docs/src/components/VersionSelector.astro new file mode 100644 index 000000000..3584e6225 --- /dev/null +++ b/docs/src/components/VersionSelector.astro @@ -0,0 +1,73 @@ +--- +import Select from '@astrojs/starlight/components/Select.astro' + +const defaultVersion = 'v3' +const versions = [ + { + code: 'v4', + url: 'https://v4.reatom.dev/', + }, + { + code: 'v3', + url: 'https://v3.reatom.dev/', + }, +] +const defaultURL = versions.find((a) => a.code === defaultVersion)!.url +--- + + +