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