design: implement more intuitive all comments/show context buttons

This commit is contained in:
Xylight committed 2025-10-25 18:21:31 -07:00
1 parent ca48d31c98
commit 81a5998b8a
5 files changed
+84 -62

No files matched your search

+2 -2
View File
@@ -12,7 +12,7 @@ import { DEFAULT_INSTANCE_URL } from './instance.svelte'
import { instanceToURL, moveItem } from './util.svelte'
function getFromStorage<T>(key: string): T | undefined {
if (typeof localStorage == 'undefined') return undefined
if (!browser) return
const lc = localStorage.getItem(key)
if (!lc) return undefined
@@ -20,7 +20,7 @@ function getFromStorage<T>(key: string): T | undefined {
}
function setFromStorage(key: string, item: any, stringify: boolean = true) {
if (typeof localStorage == 'undefined') return
if (!browser) return
return localStorage.setItem(key, stringify ? JSON.stringify(item) : item)
}
-2
View File
@@ -301,8 +301,6 @@
"commentCount": "Comments",
"addComment": "Add a comment",
"scrollToTop": "Scroll to top",
"remoteView": "Remote View",
"localView": "Local View",
"thread": {
"single": "You're viewing a single thread.",
"allComments": "All comments",
+33 -12
View File
@@ -23,11 +23,17 @@
none: '',
}
const alignments = {
default: '',
center: '',
}
interface Props {
class?: ClassValue
size?: keyof typeof sizes
color?: keyof typeof colors
margin?: keyof typeof margins
alignment?: keyof typeof alignments
border?: boolean
children?: import('svelte').Snippet
action?: import('svelte').Snippet
@@ -43,9 +49,19 @@
color = 'subtle',
margin = 'none',
element = 'h3',
alignment = 'default',
}: Props = $props()
</script>
{#snippet divider()}
<div
class={[
'flex-1 border-slate-200/70 dark:border-zinc-800 border-b',
!border && 'opacity-0',
]}
></div>
{/snippet}
<div
class={[
'flex flex-row items-center gap-2 flex-wrap',
@@ -55,17 +71,22 @@
clazz,
]}
>
<svelte:element
this={element}
class="font-medium text-left flex flex-row gap-1 items-center"
>
{@render children?.()}
</svelte:element>
<div
class={[
'flex-1 border-slate-200/70 dark:border-zinc-800 border-b',
!border && 'opacity-0',
]}
></div>
{#if alignment == 'center'}
{@render divider()}
{/if}
{#if children}
<svelte:element
this={element}
class="font-medium text-left flex flex-row gap-1 items-center"
>
{@render children?.()}
</svelte:element>
{/if}
{#if alignment == 'default'}
{@render divider()}
{/if}
{@render action?.()}
{#if alignment == 'center'}
{@render divider()}
{/if}
</div>