mirror of
https://github.com/LukeHagar/website.git
synced 2025-12-10 12:57:49 +00:00
update
This commit is contained in:
@@ -2,8 +2,9 @@
|
|||||||
import { type Theme, currentTheme } from '$routes/+layout.svelte';
|
import { type Theme, currentTheme } from '$routes/+layout.svelte';
|
||||||
|
|
||||||
import Select, { type SelectOption } from './Select.svelte';
|
import Select, { type SelectOption } from './Select.svelte';
|
||||||
|
import { Select as S } from '$lib/components/ui';
|
||||||
|
|
||||||
const options: SelectOption<Theme>[] = [
|
const options = [
|
||||||
{
|
{
|
||||||
value: 'dark',
|
value: 'dark',
|
||||||
label: 'Dark',
|
label: 'Dark',
|
||||||
@@ -23,3 +24,4 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Select {options} bind:value={$currentTheme} placement="top" />
|
<Select {options} bind:value={$currentTheme} placement="top" />
|
||||||
|
<S {options} bind:value={$currentTheme} />
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
export { default as Button } from './button.svelte';
|
export { default as Button } from './button.svelte';
|
||||||
export { default as InlineTag } from './inline-tag.svelte';
|
export { default as InlineTag } from './inline-tag.svelte';
|
||||||
export { default as Icon, type IconType } from './icon';
|
export { default as Icon, type IconType } from './icon';
|
||||||
|
export { default as Select } from './select.svelte';
|
||||||
@@ -1,21 +1,32 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Select } from 'melt/builders';
|
import { Select, type SelectProps } from 'melt/builders';
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
options: Array<{
|
options: Array<{
|
||||||
label: string;
|
label: string;
|
||||||
value: string;
|
value: string;
|
||||||
|
icon: string;
|
||||||
}>;
|
}>;
|
||||||
};
|
defaultValue?: string;
|
||||||
|
value?: string;
|
||||||
|
} & SelectProps<string>;
|
||||||
|
|
||||||
const { options }: Props = $props();
|
const {
|
||||||
|
options,
|
||||||
|
value = $bindable(),
|
||||||
|
defaultValue = 'Select a value',
|
||||||
|
...rest
|
||||||
|
}: Props = $props();
|
||||||
type Option = (typeof options)[number];
|
type Option = (typeof options)[number];
|
||||||
|
|
||||||
const select = new Select<Option['value']>();
|
const select = new Select<Option['value']>({
|
||||||
|
value,
|
||||||
|
...rest
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<button {...select.trigger}>
|
<button {...select.trigger}>
|
||||||
{select.value ?? 'Select an anime'}
|
{select.value ?? defaultValue}
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div {...select.content}>
|
<div {...select.content}>
|
||||||
|
|||||||
@@ -195,33 +195,16 @@
|
|||||||
<link rel="canonical" href={canonicalUrl} />
|
<link rel="canonical" href={canonicalUrl} />
|
||||||
</svelte:head>
|
</svelte:head>
|
||||||
|
|
||||||
<a class="skip" href="#main">Skip to content</a>
|
<a
|
||||||
|
class="bg-mint-500 focus:pointer-events-all pointer-events-none absolute inset-y-0 z-9999 block px-5 py-3 text-black underline opacity-0 focus:relative focus:opacity-1"
|
||||||
|
href="#main">Skip to content</a
|
||||||
|
>
|
||||||
|
|
||||||
<slot />
|
<slot />
|
||||||
|
<SvelteTheme />
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
:global(html) {
|
:global(html) {
|
||||||
color-scheme: dark;
|
color-scheme: dark;
|
||||||
}
|
}
|
||||||
|
|
||||||
.skip {
|
|
||||||
position: absolute;
|
|
||||||
inset-block-start: 0;
|
|
||||||
z-index: 9999;
|
|
||||||
|
|
||||||
display: block;
|
|
||||||
background-color: hsl(var(--web-color-mint-500));
|
|
||||||
color: hsl(var(--web-color-black));
|
|
||||||
text-decoration: underline;
|
|
||||||
opacity: 0;
|
|
||||||
|
|
||||||
padding: 0.75rem 1.25rem;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.skip:focus {
|
|
||||||
opacity: 1;
|
|
||||||
position: relative;
|
|
||||||
pointer-events: all;
|
|
||||||
}
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user