refactor: use icon prop instead of snippet prefix

This commit is contained in:
James Xylight committed 2025-09-07 11:28:59 -07:00
1 parent 3e909600d9
commit 772c6d22c5
56 files changed
+409 -595

No files matched your search

@@ -74,11 +74,8 @@
rounding="pill"
size="square-md"
class="text-slate-600 dark:text-zinc-400"
>
{#snippet prefix()}
<Icon src={EllipsisHorizontal} size="16" micro />
{/snippet}
</Button>
icon={EllipsisHorizontal}
></Button>
{/snippet}
<MenuButton
onclick={() => {
@@ -88,18 +85,13 @@
})
else navigator.clipboard.writeText(comment.comment.ap_id)
}}
icon={Share}
>
{#snippet prefix()}
<Icon src={Share} mini size="16" />
{/snippet}
{$t('post.actions.more.share')}
</MenuButton>
{#if profile.current?.jwt}
{#if comment.creator.id == profile.current.user?.local_user_view.person.id}
<MenuButton onclick={() => onedit?.(comment)}>
{#snippet prefix()}
<Icon src={PencilSquare} mini size="16" />
{/snippet}
<MenuButton onclick={() => onedit?.(comment)} icon={PencilSquare}>
{$t('post.actions.more.edit')}
</MenuButton>
{/if}
@@ -108,10 +100,8 @@
if (profile.current?.jwt)
comment.saved = await save(comment, !comment.saved)
}}
icon={comment.saved ? BookmarkSlash : Bookmark}
>
{#snippet prefix()}
<Icon src={comment.saved ? BookmarkSlash : Bookmark} mini size="16" />
{/snippet}
{comment.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
</MenuButton>
{#if profile.current?.user && profile.current.jwt && profile.current.user.local_user_view.person.id == comment.creator.id}
@@ -124,20 +114,19 @@
!comment.comment.deleted,
)
}}
icon={Trash}
>
{#snippet prefix()}
<Icon src={Trash} mini size="16" />
{/snippet}
{comment.comment.deleted
? $t('post.actions.more.restore')
: $t('post.actions.more.delete')}
</MenuButton>
{/if}
{#if profile.current.jwt && profile.current.user?.local_user_view.person.id != comment.creator.id}
<MenuButton onclick={() => report(comment)} color="danger-subtle">
{#snippet prefix()}
<Icon src={Flag} mini size="16" />
{/snippet}
<MenuButton
onclick={() => report(comment)}
color="danger-subtle"
icon={Flag}
>
{$t('moderation.report')}
</MenuButton>
{/if}
@@ -77,7 +77,7 @@
</script>
<form
onsubmit={e => {
onsubmit={(e) => {
e.preventDefault()
submit()
}}
@@ -1,12 +1,12 @@
<script lang="ts">
import { browser } from '$app/environment'
import { goto } from '$app/navigation'
import { t } from '$lib/i18n/translations'
import { client } from '$lib/client/lemmy.svelte'
import { errorMessage } from '$lib/lemmy/error'
import type { Post } from '$lib/client/types'
import { t } from '$lib/i18n/translations'
import { errorMessage } from '$lib/lemmy/error'
import { Button, toast } from 'mono-svelte'
import { ArrowDownCircle, Icon } from 'svelte-hero-icons'
import { ArrowDownCircle } from 'svelte-hero-icons'
import Comment from './Comment.svelte'
import Comments from './CommentTree.svelte'
import { buildCommentsTree, type CommentNodeI } from './comments.svelte'
@@ -129,15 +129,8 @@
)
}
}}
icon={ArrowDownCircle}
>
{#snippet prefix()}
<Icon
src={ArrowDownCircle}
micro
size="16"
class="text-primary-900 dark:text-primary-100"
/>
{/snippet}
{$t('comment.more', {
comments: node.comment_view.counts.child_count,
})}