impr: improve select menu semantics

This commit is contained in:
James Xylight committed 2025-08-29 16:09:22 -07:00
1 parent f105240559
commit ebf53faa10
13 files changed
+170 -187

No files matched your search

+45 -48
View File
@@ -88,53 +88,50 @@
</Option>
</Select>
{#if selected?.startsWith('Top')}
<div transition:fly={{ easing: backOut, x: 2 }}>
<Select
class="border-l-0 rounded-l-none"
bind:value={selected}
onchange={() => {
sort = 'TopAll'
if (navigate)
searchParam(page.url, 'sort', selected, 'page', 'cursor')
}}
>
{#snippet customLabel()}
<span class="flex items-center gap-1">
<Icon src={Clock} size="15" micro />
{$t('filter.sort.top.time.label')}
</span>
{/snippet}
<Option value="TopAll" icon={PlusCircle}>
{$t('filter.sort.top.time.all')}
</Option>
<Option value="TopNineMonths" icon={Calendar}>
{$t('filter.sort.top.time.9months')}
</Option>
<Option value="TopSixMonths" icon={Calendar}>
{$t('filter.sort.top.time.6months')}
</Option>
<Option value="TopThreeMonths" icon={Calendar}>
{$t('filter.sort.top.time.3months')}
</Option>
<Option value="TopMonth" icon={CalendarDays}>
{$t('filter.sort.top.time.month')}
</Option>
<Option value="TopWeek" icon={CalendarDays}>
{$t('filter.sort.top.time.week')}
</Option>
<Option value="TopDay" icon={Sun}>
{$t('filter.sort.top.time.day')}
</Option>
<Option value="TopTwelveHour" icon={Clock}>
{$t('filter.sort.top.time.12hours')}
</Option>
<Option value="TopSixHour" icon={Clock}>
{$t('filter.sort.top.time.6hours')}
</Option>
<Option value="TopHour" icon={Clock}>
{$t('filter.sort.top.time.hour')}
</Option>
</Select>
</div>
<Select
class="border-l-0 rounded-l-none"
bind:value={selected}
onchange={() => {
sort = 'TopAll'
if (navigate) searchParam(page.url, 'sort', selected, 'page', 'cursor')
}}
>
{#snippet customLabel()}
<span class="flex items-center gap-1">
<Icon src={Clock} size="15" micro />
{$t('filter.sort.top.time.label')}
</span>
{/snippet}
<Option value="TopAll" icon={PlusCircle}>
{$t('filter.sort.top.time.all')}
</Option>
<Option value="TopNineMonths" icon={Calendar}>
{$t('filter.sort.top.time.9months')}
</Option>
<Option value="TopSixMonths" icon={Calendar}>
{$t('filter.sort.top.time.6months')}
</Option>
<Option value="TopThreeMonths" icon={Calendar}>
{$t('filter.sort.top.time.3months')}
</Option>
<Option value="TopMonth" icon={CalendarDays}>
{$t('filter.sort.top.time.month')}
</Option>
<Option value="TopWeek" icon={CalendarDays}>
{$t('filter.sort.top.time.week')}
</Option>
<Option value="TopDay" icon={Sun}>
{$t('filter.sort.top.time.day')}
</Option>
<Option value="TopTwelveHour" icon={Clock}>
{$t('filter.sort.top.time.12hours')}
</Option>
<Option value="TopSixHour" icon={Clock}>
{$t('filter.sort.top.time.6hours')}
</Option>
<Option value="TopHour" icon={Clock}>
{$t('filter.sort.top.time.hour')}
</Option>
</Select>
{/if}
</div>
@@ -144,8 +144,9 @@
>
{#if showCommunity && community}
<Popover>
{#snippet target()}
{#snippet target(attachment)}
<button
{@attach attachment}
class={[
'row-span-2 shrink-0 mr-2 self-center group/btn',
'bg-slate-200 dark:bg-zinc-800 rounded-lg cursor-pointer',
@@ -177,6 +178,7 @@
rounding="2xl"
elevation="high"
class="max-w-2xl w-full max-h-128 overflow-auto"
data-autoclose="false"
>
{#await import('../community/CommunityHeader.svelte') then { default: CommunityHeader }}
<CommunityHeader {community} {subscribed} />
+1 -1
View File
@@ -41,7 +41,7 @@
'transition-transform duration-300 ease-out',
]}
>
<Icon src={open ? Minus : Plus} size="16" micro class={[]} />
<Icon src={open ? Minus : Plus} size="15" micro class={[]} />
</div>
{/if}
<div
+3 -9
View File
@@ -10,23 +10,21 @@
<script lang="ts">
import { page } from '$app/state'
import { t } from '$lib/i18n/translations'
import { Button, Material, toast } from 'mono-svelte'
import { focusTrap } from 'svelte-focus-trap'
import { Icon, Share, XMark } from 'svelte-hero-icons'
import { expoOut } from 'svelte/easing'
import { fade, scale } from 'svelte/transition'
import { focusTrap } from 'svelte-focus-trap'
import { t } from '$lib/i18n/translations'
interface Props {
/**
* The full-resolution image URL
*/
alt?: string
class?: string
children?: import('svelte').Snippet
}
let { alt = '', class: clazz = '', children }: Props = $props()
let { alt = '' }: Props = $props()
</script>
{#if page.state.openImage || '' != ''}
@@ -88,7 +86,3 @@
</div>
</div>
{/if}
<button onclick={() => history.back()} class="contents {clazz}">
{@render children?.()}
</button>
+1 -1
View File
@@ -142,7 +142,7 @@
<Spinner width={20} />
</div>
{:then { default: Profile }}
<Profile />
<Profile />
{/await}
{/if}
{/snippet}
+25 -28
View File
@@ -133,34 +133,31 @@
{/snippet}
{$t('nav.menu.settings')}
</MenuButton>
<!--svelte-ignore a11y_click_events_have_key_events-->
<!--svelte-ignore a11y_no_static_element_interactions-->
<div onclick={e => e.stopPropagation()}>
<Select bind:value={theme.colorScheme} size="sm">
{#snippet target(attachment)}
<MenuButton
{@attach attachment}
icon={theme.colorScheme == 'system'
? ComputerDesktop
: theme.colorScheme == 'light'
? Sun
: Moon}
class=" w-full"
>
{$t('nav.menu.colorscheme.label')}
</MenuButton>
<Option value="system" class="hidden" icon={ComputerDesktop}>
{$t('nav.menu.colorscheme.system')}
</Option>
<Option value="light" class="hidden" icon={Sun}>
{$t('nav.menu.colorscheme.light')}
</Option>
<Option value="dark" class="hidden" icon={Moon}>
{$t('nav.menu.colorscheme.dark')}
</Option>
{/snippet}
</Select>
</div>
<Select bind:value={theme.colorScheme} size="sm" placement="left">
{#snippet target(attachment)}
<MenuButton
{@attach attachment}
icon={theme.colorScheme == 'system'
? ComputerDesktop
: theme.colorScheme == 'light'
? Sun
: Moon}
class=" w-full"
nest
>
{$t('nav.menu.colorscheme.label')}
</MenuButton>
<Option value="system" class="hidden" icon={ComputerDesktop}>
{$t('nav.menu.colorscheme.system')}
</Option>
<Option value="light" class="hidden" icon={Sun}>
{$t('nav.menu.colorscheme.light')}
</Option>
<Option value="dark" class="hidden" icon={Moon}>
{$t('nav.menu.colorscheme.dark')}
</Option>
{/snippet}
</Select>
<MenuButton href="/theme">
{#snippet prefix()}
<Icon src={Swatch} size="16" micro />
+4 -1
View File
@@ -11,8 +11,10 @@
import {
ArrowLeftOnRectangle,
Bookmark,
ChevronUpDown,
Cog6Tooth,
ComputerDesktop,
Icon,
Identification,
Inbox,
Moon,
@@ -92,7 +94,7 @@
: theme.colorScheme == 'light'
? Sun
: Moon}
class=" w-full"
class="w-full relative"
>
<Option value="system" class="hidden" icon={ComputerDesktop}>
{$t('nav.menu.colorscheme.system')}
@@ -103,6 +105,7 @@
<Option value="dark" class="hidden" icon={Moon}>
{$t('nav.menu.colorscheme.dark')}
</Option>
<Icon micro size="16" src={ChevronUpDown} class="ml-auto" />
</SidebarButton>
{/snippet}
</Select>