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