mirror of
https://code.castopod.org/adaures/castopod
synced 2025-06-06 18:31:05 +00:00
34 lines
872 B
Plaintext
34 lines
872 B
Plaintext
![]() |
---
|
||
|
import Select from '@astrojs/starlight/components/Select.astro';
|
||
|
import type { Props } from '@astrojs/starlight/props';
|
||
|
---
|
||
|
|
||
|
<docs-version-select>
|
||
|
<Select
|
||
|
icon="starlight"
|
||
|
label="version"
|
||
|
value="develop"
|
||
|
options={[
|
||
|
{ label: 'develop', selected: import.meta.env.BASE_URL === '/develop', value: '/develop' },
|
||
|
{ label: 'next', selected: import.meta.env.BASE_URL === '/next', value: '/next' },
|
||
|
]}
|
||
|
width="7em"
|
||
|
/>
|
||
|
</docs-version-select>
|
||
|
|
||
|
<script>
|
||
|
class DocsVersionSelect extends HTMLElement {
|
||
|
constructor() {
|
||
|
super();
|
||
|
const select = this.querySelector('select');
|
||
|
if (select) {
|
||
|
select.addEventListener('change', (e) => {
|
||
|
if (e.currentTarget instanceof HTMLSelectElement) {
|
||
|
window.location.pathname = e.currentTarget.value;
|
||
|
}
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
customElements.define('docs-version-select', DocsVersionSelect);
|
||
|
</script>
|