diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-22 14:58:26 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-22 14:59:09 +0300 |
| commit | c234f221f9be698bc0501c60459e1ae8e67df6c3 (patch) | |
| tree | 944b4dec10fada8d93456dc5a85e6bfdb36a8b8b /website/src/components/Search.astro | |
| parent | ef85fa0c7ebb48bb59fe7593af5a67f3e02ff3d4 (diff) | |
feat(docs): publish versioned release documentation
Diffstat (limited to 'website/src/components/Search.astro')
| -rw-r--r-- | website/src/components/Search.astro | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/website/src/components/Search.astro b/website/src/components/Search.astro index 2a31ea24..cceeed34 100644 --- a/website/src/components/Search.astro +++ b/website/src/components/Search.astro @@ -1,25 +1,25 @@ --- import StarlightSearch from '@astrojs/starlight/components/Search.astro'; -import { docsChannel } from '../docs-path'; +import { docsVersion } from '../docs-path'; -const channel = docsChannel(Astro.url.pathname); +const version = docsVersion(Astro.url.pathname); --- -<channel-search data-channel={channel}> +<version-search data-version={version}> <StarlightSearch /> -</channel-search> +</version-search> <script> - class ChannelSearch extends HTMLElement { + class VersionSearch extends HTMLElement { observer?: MutationObserver; connectedCallback() { - const channel = this.dataset.channel; - if (!channel) return; + const version = this.dataset.version; + if (!version) return; - const selectChannel = () => { + const selectVersion = () => { const checkbox = this.querySelector<HTMLInputElement>( - `.pagefind-ui__filter-checkbox[name="channel"][value="${channel}"]`, + `.pagefind-ui__filter-checkbox[name="version"][value="${version}"]`, ); if (!checkbox) return false; if (!checkbox.checked) checkbox.click(); @@ -27,9 +27,9 @@ const channel = docsChannel(Astro.url.pathname); return true; }; - if (selectChannel()) return; + if (selectVersion()) return; // Starlight does not expose its PagefindUI instance, so wait for Pagefind's filter control. - this.observer = new MutationObserver(selectChannel); + this.observer = new MutationObserver(selectVersion); this.observer.observe(this, { childList: true, subtree: true }); } @@ -38,15 +38,15 @@ const channel = docsChannel(Astro.url.pathname); } } - customElements.define('channel-search', ChannelSearch); + customElements.define('version-search', VersionSearch); </script> <style> - channel-search { + version-search { display: contents; } - channel-search :global(.pagefind-ui__filter-panel) { + version-search :global(.pagefind-ui__filter-panel) { display: none; } </style> |
