design: improve command palette
This commit is contained in:
4 files changed
+15
-22
No files matched your search
@@ -179,9 +179,6 @@
|
||||
{#snippet title()}
|
||||
<span class="py-1 px-1 flex gap-1 items-center w-full">
|
||||
{$t('cards.site.about')}
|
||||
<hr
|
||||
class="w-full flex-1 ml-1 border-slate-200 dark:border-zinc-800"
|
||||
/>
|
||||
</span>
|
||||
{/snippet}
|
||||
<Markdown source={community_view.community.description} />
|
||||
@@ -192,9 +189,6 @@
|
||||
{#snippet title()}
|
||||
<span class="py-1 px-1 flex gap-1 items-center w-full">
|
||||
{$t('cards.site.stats')}
|
||||
<hr
|
||||
class="w-full flex-1 ml-1 border-slate-200 dark:border-zinc-800"
|
||||
/>
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="flex flex-row gap-4 flex-wrap">
|
||||
@@ -217,10 +211,6 @@
|
||||
{#snippet title()}
|
||||
<span class="py-1 px-1 flex gap-1 items-center w-full">
|
||||
{$t('cards.community.moderators')}
|
||||
|
||||
<hr
|
||||
class="w-full flex-1 ml-1 border-slate-200 dark:border-zinc-800"
|
||||
/>
|
||||
</span>
|
||||
{/snippet}
|
||||
<ItemList
|
||||
|
||||
@@ -107,7 +107,8 @@
|
||||
new Date().getTime() - 5 * 60 * 1000}
|
||||
<Icon
|
||||
src={newComment ? ChatBubbleOvalLeftEllipsis : ChatBubbleOvalLeft}
|
||||
size="18"
|
||||
size="16"
|
||||
mini
|
||||
/>
|
||||
<FormattedNumber number={post.counts.comments} />
|
||||
</Button>
|
||||
|
||||
@@ -13,15 +13,14 @@
|
||||
onclick?: HTMLButtonAttributes['onclick']
|
||||
}
|
||||
|
||||
let { action, class: clazz = '', children, ...rest }: Props = $props()
|
||||
let { action, children, ...rest }: Props = $props()
|
||||
</script>
|
||||
|
||||
<Button
|
||||
href={action.href}
|
||||
alignment="left"
|
||||
color="tertiary"
|
||||
size="lg"
|
||||
class="focus:bg-slate-200 dark:focus:bg-zinc-800 block w-full {clazz}"
|
||||
color="none"
|
||||
size="custom"
|
||||
data-sveltekit-preload-code="viewport"
|
||||
data-sveltekit-preload-data="tap"
|
||||
{...rest}
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
import { getGroups, type Action, type Group } from './actions.svelte'
|
||||
import CommandItem from './CommandItem.svelte'
|
||||
import { fuzzySearch } from '$lib/util.svelte'
|
||||
import CommonList from '../../layout/CommonList.svelte'
|
||||
|
||||
interface Props {
|
||||
open?: boolean
|
||||
@@ -227,7 +228,7 @@
|
||||
|
||||
<TextInput
|
||||
bind:value={search}
|
||||
class="sticky rounded-none border-t-0 border-x-0 dark:focus-within:border-zinc-800"
|
||||
class="sticky rounded-none! border-t-0 border-x-0 focus-within:border-inherit! focus-within:ring-0!"
|
||||
size="lg"
|
||||
placeholder={$t('nav.commands.prompt')}
|
||||
bind:element={input}
|
||||
@@ -253,13 +254,18 @@
|
||||
{#each filteredGroups as group, groupIndex}
|
||||
<div class="space-y-1">
|
||||
<span class="text-sm font-medium">{group.name}</span>
|
||||
<ul class="flex flex-col gap-1">
|
||||
<CommonList size="xs" class="p-0! sm:p-0! lg:p-0!">
|
||||
{#each group.actions as action, actionIndex}
|
||||
{@const globalIndex =
|
||||
filteredGroups
|
||||
.slice(0, groupIndex)
|
||||
.reduce((sum, g) => sum + g.actions.length, 0) + actionIndex}
|
||||
<li>
|
||||
<li
|
||||
class={[
|
||||
'custom-size',
|
||||
globalIndex == selectedIndex && 'brightness-125',
|
||||
]}
|
||||
>
|
||||
<CommandItem
|
||||
{action}
|
||||
onclick={e => {
|
||||
@@ -270,13 +276,10 @@
|
||||
e.stopPropagation()
|
||||
handleSelect(action)
|
||||
}}
|
||||
class="{globalIndex == selectedIndex
|
||||
? 'bg-slate-100! dark:bg-zinc-800! text-inherit'
|
||||
: 'text-slate-600 dark:text-zinc-400'} block"
|
||||
/>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
</CommonList>
|
||||
</div>
|
||||
{/each}
|
||||
{#if search != ''}
|
||||
|
||||
Reference in new issue
Block a user