fix: arrow icon being misplaced
This commit is contained in:
2 files changed
+118
-122
No files matched your search
@@ -95,89 +95,91 @@
|
||||
{#snippet selectTarget(attachment: Attachment)}
|
||||
<Label text={label} class={['space-y-1 relative', clazz, baseClass]}>
|
||||
{@render customLabel?.()}
|
||||
<Icon
|
||||
src={ChevronUpDown}
|
||||
micro
|
||||
size="16"
|
||||
class="absolute right-1.5 bottom-1 box-border pointer-events-none z-10 text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
<select
|
||||
{@attach attachment}
|
||||
{...rest}
|
||||
bind:this={element}
|
||||
class={[
|
||||
buttonSize[size],
|
||||
buttonShadow[shadow],
|
||||
buttonColor.secondary,
|
||||
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
|
||||
selectClass,
|
||||
clazz,
|
||||
]}
|
||||
bind:value
|
||||
onmousedown={e => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={e => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
{onchange}
|
||||
{oncontextmenu}
|
||||
{placeholder}
|
||||
>
|
||||
{#if placeholder}
|
||||
<option disabled selected value="">{placeholder}</option>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</select>
|
||||
<div class="relative" role="presentation">
|
||||
<select
|
||||
{@attach attachment}
|
||||
{...rest}
|
||||
bind:this={element}
|
||||
class={[
|
||||
buttonSize[size],
|
||||
buttonShadow[shadow],
|
||||
buttonColor.secondary,
|
||||
'appearance-none transition-colors rounded-xl text-sm w-full min-w-full cursor-pointer pr-6',
|
||||
selectClass,
|
||||
clazz,
|
||||
]}
|
||||
bind:value
|
||||
onmousedown={e => {
|
||||
e.preventDefault()
|
||||
}}
|
||||
onkeypress={e => {
|
||||
e.preventDefault()
|
||||
open = !open
|
||||
}}
|
||||
{onchange}
|
||||
{oncontextmenu}
|
||||
{placeholder}
|
||||
>
|
||||
{#if placeholder}
|
||||
<option disabled selected value="">{placeholder}</option>
|
||||
{/if}
|
||||
{@render children?.()}
|
||||
</select>
|
||||
<Icon
|
||||
src={ChevronUpDown}
|
||||
micro
|
||||
size="16"
|
||||
class="absolute bottom-1/2 translate-y-1/2 right-1 box-border pointer-events-none z-10 text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
</div>
|
||||
</Label>
|
||||
{/snippet}
|
||||
|
||||
<Menu bind:open {placement}>
|
||||
{#snippet target(attachment)}
|
||||
{@const render = passedTarget ?? selectTarget}
|
||||
{@render render?.(attachment)}
|
||||
{/snippet}
|
||||
{#each context.options as option (option)}
|
||||
{#if customOption}{@render customOption({
|
||||
option,
|
||||
selected: option.value == value,
|
||||
})}{:else}
|
||||
<MenuButton
|
||||
onclick={async () => {
|
||||
value = option.value
|
||||
await tick()
|
||||
element?.dispatchEvent(new Event('change', { bubbles: true }))
|
||||
}}
|
||||
size="custom"
|
||||
disabled={option.disabled}
|
||||
color="none"
|
||||
class={[
|
||||
'min-h-0! py-1 hover:bg-slate-100 dark:hover:bg-zinc-800',
|
||||
option.value == value &&
|
||||
'bg-slate-100 dark:bg-zinc-800 text-primary-900 dark:text-primary-100 font-medium',
|
||||
option.disabled &&
|
||||
'pointer-events-none text-slate-600 dark:text-zinc-400',
|
||||
option.isLabel && 'text-xs mt-2',
|
||||
]}
|
||||
>
|
||||
{#if option.value == value}
|
||||
<Icon
|
||||
src={CheckCircle}
|
||||
size="16"
|
||||
micro
|
||||
class="text-primary-900 dark:text-primary-100"
|
||||
/>
|
||||
{:else if option.icon}
|
||||
<Icon
|
||||
src={option.icon}
|
||||
size="16"
|
||||
micro
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
{/if}
|
||||
{@html option.label}
|
||||
</MenuButton>
|
||||
<Menu bind:open {placement}>
|
||||
{#snippet target(attachment)}
|
||||
{@const render = passedTarget ?? selectTarget}
|
||||
{@render render?.(attachment)}
|
||||
{/snippet}
|
||||
{#each context.options as option (option)}
|
||||
{#if customOption}{@render customOption({
|
||||
option,
|
||||
selected: option.value == value,
|
||||
})}{:else}
|
||||
<MenuButton
|
||||
onclick={async () => {
|
||||
value = option.value
|
||||
await tick()
|
||||
element?.dispatchEvent(new Event('change', { bubbles: true }))
|
||||
}}
|
||||
size="custom"
|
||||
disabled={option.disabled}
|
||||
color="none"
|
||||
class={[
|
||||
'min-h-0! py-1 hover:bg-slate-100 dark:hover:bg-zinc-800',
|
||||
option.value == value &&
|
||||
'bg-slate-100 dark:bg-zinc-800 text-primary-900 dark:text-primary-100 font-medium',
|
||||
option.disabled &&
|
||||
'pointer-events-none text-slate-600 dark:text-zinc-400',
|
||||
option.isLabel && 'text-xs mt-2',
|
||||
]}
|
||||
>
|
||||
{#if option.value == value}
|
||||
<Icon
|
||||
src={CheckCircle}
|
||||
size="16"
|
||||
micro
|
||||
class="text-primary-900 dark:text-primary-100"
|
||||
/>
|
||||
{:else if option.icon}
|
||||
<Icon
|
||||
src={option.icon}
|
||||
size="16"
|
||||
micro
|
||||
class="text-slate-600 dark:text-zinc-400"
|
||||
/>
|
||||
{/if}
|
||||
{/each}
|
||||
</Menu>
|
||||
{@html option.label}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{/each}
|
||||
</Menu>
|
||||
@@ -153,47 +153,41 @@
|
||||
class="flex flex-row flex-wrap
|
||||
flex-1 gap-2 w-full lg:w-max max-w-full lg:self-end"
|
||||
>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.feed}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('filter.location.all')}</Option>
|
||||
<Option value="Local">{$t('filter.location.local')}</Option>
|
||||
<Option value="Subscribed">
|
||||
{$t('filter.location.subscribed')}
|
||||
</Option>
|
||||
<Option value="Moderator">
|
||||
{$t('filter.location.moderator')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Sort bind:selected={settings.defaultSort.sort} navigate={false} />
|
||||
</div>
|
||||
<div class="max-w-full">
|
||||
<Select bind:value={settings.defaultSort.comments}>
|
||||
{#snippet customLabel()}
|
||||
<span class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</span>
|
||||
{/snippet}
|
||||
<Select bind:value={settings.defaultSort.feed}>
|
||||
{#snippet customLabel()}
|
||||
<div class="flex items-center gap-1">
|
||||
<Icon src={GlobeAmericas} size="16" mini />
|
||||
{$t('filter.location.label')}
|
||||
</div>
|
||||
{/snippet}
|
||||
<Option value="All">{$t('filter.location.all')}</Option>
|
||||
<Option value="Local">{$t('filter.location.local')}</Option>
|
||||
<Option value="Subscribed">
|
||||
{$t('filter.location.subscribed')}
|
||||
</Option>
|
||||
<Option value="Moderator">
|
||||
{$t('filter.location.moderator')}
|
||||
</Option>
|
||||
</Select>
|
||||
<Sort bind:selected={settings.defaultSort.sort} navigate={false} />
|
||||
<Select bind:value={settings.defaultSort.comments}>
|
||||
{#snippet customLabel()}
|
||||
<div class="flex items-center gap-1">
|
||||
<Icon src={ChatBubbleOvalLeftEllipsis} size="14" mini />
|
||||
{$t('content.comments')}
|
||||
</div>
|
||||
{/snippet}
|
||||
|
||||
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||
<Option icon={Trophy} value="Top">
|
||||
{$t('filter.sort.top.label')}
|
||||
</Option>
|
||||
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||
<Option icon={Clock} value="Old">{$t('filter.sort.old')}</Option>
|
||||
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
<Option icon={Fire} value="Hot">{$t('filter.sort.hot')}</Option>
|
||||
<Option icon={Trophy} value="Top">
|
||||
{$t('filter.sort.top.label')}
|
||||
</Option>
|
||||
<Option icon={Star} value="New">{$t('filter.sort.new')}</Option>
|
||||
<Option icon={Clock} value="Old">{$t('filter.sort.old')}</Option>
|
||||
<Option icon={ArrowTrendingDown} value="Controversial">
|
||||
{$t('filter.sort.controversial')}
|
||||
</Option>
|
||||
</Select>
|
||||
</div>
|
||||
</Setting>
|
||||
<ToggleSetting
|
||||
|
||||
Reference in new issue
Block a user