design: use ghost rounded icons for post actions

This commit is contained in:
Xylight committed 2024-07-24 19:07:05 -07:00
1 parent b93729f4ac
commit 18d2e8fc1e
2 files changed
+23 -12

No files matched your search

@@ -148,11 +148,13 @@
<Button <Button
size="sm" size="sm"
href="/post/{getInstance()}/{post.post.id}" href="/post/{getInstance()}/{post.post.id}"
class="!text-inherit h-full px-3" class="text-inherit h-full px-3"
color="ghost"
rounding="pill"
target={$userSettings.openLinksInNewTab ? '_blank' : ''} target={$userSettings.openLinksInNewTab ? '_blank' : ''}
title={$t('post.actions.comments')} title={$t('post.actions.comments')}
> >
<Icon slot="prefix" src={ChatBubbleOvalLeft} mini size="14" /> <Icon slot="prefix" src={ChatBubbleOvalLeft} size="18" />
<FormattedNumber number={post.counts.comments} /> <FormattedNumber number={post.counts.comments} />
</Button> </Button>
<div class="ml-auto" /> <div class="ml-auto" />
@@ -168,6 +170,7 @@
title="Debug" title="Debug"
size="custom" size="custom"
color="ghost" color="ghost"
rounding="pill"
class={buttonSquare} class={buttonSquare}
> >
<Icon src={BugAnt} mini size="16" slot="prefix" /> <Icon src={BugAnt} mini size="16" slot="prefix" />
@@ -176,6 +179,8 @@
{#if $profile?.user && (amMod($profile.user, post.community) || isAdmin($profile.user))} {#if $profile?.user && (amMod($profile.user, post.community) || isAdmin($profile.user))}
<ModerationMenu <ModerationMenu
size="custom" size="custom"
color="ghost"
rounding="pill"
class={buttonSquare} class={buttonSquare}
bind:item={post} bind:item={post}
community={post.community} community={post.community}
@@ -193,6 +198,7 @@
size="custom" size="custom"
class={buttonSquare} class={buttonSquare}
color="ghost" color="ghost"
rounding="pill"
loading={saving} loading={saving}
disabled={saving} disabled={saving}
title={post.saved ? $t('post.actions.unsave') : $t('post.actions.save')} title={post.saved ? $t('post.actions.unsave') : $t('post.actions.save')}
@@ -217,6 +223,7 @@
slot="target" slot="target"
title={$t('post.actions.more.label')} title={$t('post.actions.more.label')}
color="ghost" color="ghost"
rounding="pill"
size="custom" size="custom"
class={buttonSquare} class={buttonSquare}
> >
@@ -245,7 +252,7 @@
fediseerLoading = true fediseerLoading = true
const data = await fediseer.getInstanceInfo( const data = await fediseer.getInstanceInfo(
new URL(post.community.actor_id).hostname, new URL(post.community.actor_id).hostname
) )
fediseerData = data fediseerData = data
fediseerOpen = true fediseerOpen = true
@@ -300,7 +307,7 @@
navigator.clipboard.writeText( navigator.clipboard.writeText(
localShare localShare
? `${instanceToURL(getInstance())}/post/${post.post.id}` ? `${instanceToURL(getInstance())}/post/${post.post.id}`
: post.post.ap_id, : post.post.ap_id
) )
toast({ content: $t('toast.copied') }) toast({ content: $t('toast.copied') })
}} }}
@@ -367,7 +374,7 @@
post.post.deleted = await deleteItem( post.post.deleted = await deleteItem(
post, post,
!post.post.deleted, !post.post.deleted,
$profile.jwt, $profile.jwt
) )
}} }}
color="danger-subtle" color="danger-subtle"
@@ -386,7 +393,7 @@
const hidden = await hidePost( const hidden = await hidePost(
post.post.id, post.post.id,
!post.hidden, !post.hidden,
$profile?.jwt, $profile?.jwt
) )
post.hidden = hidden post.hidden = hidden
if (hidden) { if (hidden) {
+10 -6
View File
@@ -5,7 +5,7 @@
export const shouldShowVoteColor = ( export const shouldShowVoteColor = (
vote: number, vote: number,
type: 'upvotes' | 'downvotes', type: 'upvotes' | 'downvotes'
): string => ): string =>
(vote == -1 && type == 'downvotes') || (vote == 1 && type == 'upvotes') (vote == -1 && type == 'downvotes') || (vote == 1 && type == 'upvotes')
? voteColor(vote) ? voteColor(vote)
@@ -17,9 +17,13 @@
import type { Post } from 'lemmy-js-client' import type { Post } from 'lemmy-js-client'
import { import {
ArrowDown, ArrowDown,
ArrowDownCircle,
ArrowUp, ArrowUp,
ArrowUpCircle,
ChevronDown, ChevronDown,
ChevronUp, ChevronUp,
HandThumbDown,
HandThumbUp,
Icon, Icon,
Key, Key,
} from 'svelte-hero-icons' } from 'svelte-hero-icons'
@@ -57,16 +61,16 @@
<slot {vote} {score}> <slot {vote} {score}>
<div <div
class="{buttonColor.secondary} rounded-lg h-full font-medium flex items-center [&>*]:p-2 class="{buttonColor.ghost} rounded-full h-full font-medium flex items-center *:p-2
hover:bg-white hover:dark:bg-zinc-900 overflow-hidden transition-colors flex-shrink-0 hover:bg-white hover:dark:bg-zinc-900 overflow-hidden transition-colors flex-shrink-0
{loading ? 'animate-pulse opacity-75 pointer-events-none' : ''}" {loading ? 'animate-pulse opacity-75 pointer-events-none' : ''}"
> >
<button <button
on:click={() => castVote(vote == 1 ? 0 : 1)} on:click={() => castVote(vote == 1 ? 0 : 1)}
class="flex items-center gap-0.5 {buttonColor.secondary} transition-colors border-0 class="flex items-center gap-1 {buttonColor.ghost} transition-colors border-0
{vote == 1 ? shouldShowVoteColor(vote, 'upvotes') : ''}" {vote == 1 ? shouldShowVoteColor(vote, 'upvotes') : ''}"
> >
<Icon src={ChevronUp} size="18" mini /> <Icon src={ChevronUp} size="20" micro />
<span class="grid text-sm"> <span class="grid text-sm">
{#key upvotes} {#key upvotes}
<span <span
@@ -85,10 +89,10 @@
></div> ></div>
<button <button
on:click={() => castVote(vote == -1 ? 0 : -1)} on:click={() => castVote(vote == -1 ? 0 : -1)}
class="flex items-center gap-0.5 !pr-2.5 {buttonColor.secondary} transition-colors border-0 class="flex items-center flex-row-reverse gap-1 {buttonColor.ghost} transition-colors border-0
{vote == -1 ? shouldShowVoteColor(vote, 'downvotes') : ''}" {vote == -1 ? shouldShowVoteColor(vote, 'downvotes') : ''}"
> >
<Icon src={ChevronDown} size="18" mini /> <Icon src={ChevronDown} size="20" micro />
<span class="grid text-sm"> <span class="grid text-sm">
{#key downvotes} {#key downvotes}
<span <span