aboutsummaryrefslogtreecommitdiff
path: root/website/src/components/Header.astro
diff options
context:
space:
mode:
authorOgulcan Celik <ogulcancelik@gmail.com>2026-07-22 14:58:26 +0300
committerOgulcan Celik <ogulcancelik@gmail.com>2026-07-22 14:59:09 +0300
commitc234f221f9be698bc0501c60459e1ae8e67df6c3 (patch)
tree944b4dec10fada8d93456dc5a85e6bfdb36a8b8b /website/src/components/Header.astro
parentef85fa0c7ebb48bb59fe7593af5a67f3e02ff3d4 (diff)
feat(docs): publish versioned release documentation
Diffstat (limited to 'website/src/components/Header.astro')
-rw-r--r--website/src/components/Header.astro58
1 files changed, 4 insertions, 54 deletions
diff --git a/website/src/components/Header.astro b/website/src/components/Header.astro
index 982efd2e..cfa3d759 100644
--- a/website/src/components/Header.astro
+++ b/website/src/components/Header.astro
@@ -6,19 +6,12 @@ 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 DocsVersionSelect from './DocsVersionSelect.astro';
+import { docsRoute } from '../docs-path';
const shouldRenderSearch =
config.pagefind || config.components.Search !== '@astrojs/starlight/components/Search.astro';
-
-const pathname = Astro.url.pathname;
-const isDocs = pathname === '/docs/' || pathname.startsWith('/docs/');
-const isPreview = pathname === '/docs/preview/' || pathname.startsWith('/docs/preview/');
-const stableHref = isPreview ? pathname.replace(/^\/docs\/preview\/?/, '/docs/') : pathname;
-const previewHref = isPreview
- ? pathname
- : pathname === '/docs/'
- ? '/docs/preview/'
- : pathname.replace(/^\/docs\/?/, '/docs/preview/');
+const isDocs = docsRoute(Astro.url.pathname).isDocs;
---
<div class="header">
@@ -26,12 +19,7 @@ const previewHref = isPreview
<SiteTitle />
</div>
<div class="sl-flex print:hidden search-wrapper">
- {isDocs && (
- <nav class="docs-channel-switcher" aria-label="Documentation channel">
- <a href={stableHref} aria-current={!isPreview ? 'page' : undefined}>Stable</a>
- <a href={previewHref} aria-current={isPreview ? 'page' : undefined}>Preview</a>
- </nav>
- )}
+ {isDocs && <DocsVersionSelect />}
{shouldRenderSearch && <Search />}
</div>
<div class="sl-hidden md:sl-flex print:hidden right-group">
@@ -66,38 +54,6 @@ const previewHref = isPreview
min-width: 0;
}
- .docs-channel-switcher {
- display: flex;
- align-items: center;
- border: 1px solid var(--sl-color-hairline);
- border-radius: 4px;
- overflow: hidden;
- background: var(--sl-color-bg-nav);
- font-size: var(--sl-text-xs);
- font-weight: 700;
- line-height: 1;
- white-space: nowrap;
- }
-
- .docs-channel-switcher a {
- color: var(--sl-color-gray-2);
- text-decoration: none;
- padding: 0.45rem 0.6rem;
- }
-
- .docs-channel-switcher a + a {
- border-inline-start: 1px solid var(--sl-color-hairline);
- }
-
- .docs-channel-switcher a[aria-current="page"] {
- color: var(--sl-color-accent-high);
- background: color-mix(in srgb, var(--sl-color-accent) 14%, transparent);
- }
-
- .docs-channel-switcher a:hover {
- color: var(--sl-color-accent-high);
- }
-
.right-group,
.social-icons {
gap: 1rem;
@@ -110,12 +66,6 @@ const previewHref = isPreview
border-inline-end: 1px solid var(--sl-color-gray-5);
}
- @media (max-width: 38rem) {
- .docs-channel-switcher {
- display: none;
- }
- }
-
@media (min-width: 50rem) {
:global(:root[data-has-sidebar]) {
--__sidebar-pad: calc(2 * var(--sl-nav-pad-x));