feat: add customizing keybinds
This commit is contained in:
9 files changed
+113
-63
No files matched your search
@@ -101,12 +101,12 @@
|
||||
]}
|
||||
id="post-{post.post.id.toString()}"
|
||||
{onclick}
|
||||
onkeydown={(e) => {
|
||||
onkeydown={e => {
|
||||
if (e.key === 'Enter') onclick(e)
|
||||
keybindPost(e, post, voteComponent?.castVote)
|
||||
}}
|
||||
tabindex="0"
|
||||
{style}
|
||||
{@attach keybindPost(post, voteComponent?.castVote)}
|
||||
>
|
||||
<PostMeta
|
||||
community={post.community}
|
||||
|
||||
@@ -171,7 +171,7 @@
|
||||
})
|
||||
</script>
|
||||
|
||||
<svelte:body {@attach keybindFeed} />
|
||||
<svelte:body onkeydown={keybindFeed()} />
|
||||
|
||||
<ul class="flex flex-col list-none" bind:this={listEl}>
|
||||
{#key posts}
|
||||
|
||||
@@ -34,15 +34,15 @@
|
||||
{@render title?.(open)}
|
||||
</div>
|
||||
{#if icon}
|
||||
<Icon
|
||||
src={open ? Minus : Plus}
|
||||
size="16"
|
||||
micro
|
||||
<div
|
||||
class={[
|
||||
!open && 'rotate-90',
|
||||
'transition-transform duration-300 ease-out',
|
||||
'transition-all duration-300 ease-out',
|
||||
'grid place-items-center w-4',
|
||||
]}
|
||||
/>
|
||||
>
|
||||
<Icon src={open ? Minus : Plus} size="16" micro />
|
||||
</div>
|
||||
{/if}
|
||||
<div
|
||||
class="inset-0 -z-10 opacity-0 absolute bg-slate-200 dark:bg-zinc-900 rounded-full
|
||||
|
||||
@@ -29,16 +29,18 @@
|
||||
let { alt = '', class: clazz = '', children }: Props = $props()
|
||||
</script>
|
||||
|
||||
<svelte:body
|
||||
onclick={() => history.back()}
|
||||
onkeydown={e => {
|
||||
if (e.key == 'Escape') history.back()
|
||||
}}
|
||||
/>
|
||||
|
||||
{#if page.state.openImage || '' != ''}
|
||||
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
||||
<div
|
||||
class="fixed top-0 left-0 w-screen h-svh overflow-auto bg-white/50 dark:bg-black/50
|
||||
flex flex-col z-100 backdrop-blur-xs"
|
||||
transition:fade={{ duration: 150 }}
|
||||
onclick={() => history.back()}
|
||||
onkeydown={e => {
|
||||
if (e.key == 'Escape') history.back()
|
||||
}}
|
||||
use:focusTrap
|
||||
>
|
||||
<img
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
children?: Snippet
|
||||
animate?: boolean
|
||||
size?: 'lg' | 'md' | 'sm'
|
||||
depth?: 1 | 2
|
||||
}
|
||||
|
||||
let {
|
||||
@@ -21,12 +22,13 @@
|
||||
children,
|
||||
animate = true,
|
||||
size = 'sm',
|
||||
depth = 1,
|
||||
}: Props = $props()
|
||||
</script>
|
||||
|
||||
<ul class="divide-y-3 divide-slate-50 dark:divide-zinc-925">
|
||||
<ul class={['space-y-[3px]', depth == 2 && 'secondary']}>
|
||||
{#if items}
|
||||
{#each items as item, index (item)}
|
||||
{#each items as item, index}
|
||||
<li
|
||||
class={['group/li', animate && 'animate']}
|
||||
style="--i: {index < 10 ? index * sizeDelay[size] : 0}ms;"
|
||||
@@ -77,6 +79,22 @@
|
||||
}
|
||||
}
|
||||
|
||||
ul.secondary > :global(li) {
|
||||
background-color: var(--color-slate-25);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-slate-50);
|
||||
}
|
||||
}
|
||||
|
||||
:global(.dark) ul.secondary > :global(li) {
|
||||
background-color: var(--color-zinc-925);
|
||||
|
||||
&:hover {
|
||||
background-color: var(--color-zinc-800);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes pop-in {
|
||||
from {
|
||||
transform: translateY(16px);
|
||||
|
||||
Reference in new issue
Block a user