feat: update mono to 0.3.3
This commit is contained in:
1 parent
c60b1b3c02
commit
9b1ef7637b
7 files changed
+176
-191
No files matched your search
@@ -13,12 +13,10 @@
|
||||
} from 'svelte-hero-icons'
|
||||
import { profile } from '$lib/auth.js'
|
||||
import { vote as voteItem } from '$lib/lemmy/contentview.js'
|
||||
import { Button, Popover } from 'mono-svelte'
|
||||
import { Button, Material, Popover } from 'mono-svelte'
|
||||
|
||||
export let post: Post
|
||||
export let vote: number = 0
|
||||
export let upvotes: number = 0
|
||||
export let downvotes: number = 0
|
||||
export let score: number
|
||||
|
||||
const voteColor = (vote: number, border: boolean = false) =>
|
||||
@@ -26,54 +24,39 @@
|
||||
</script>
|
||||
|
||||
<slot {vote} {score}>
|
||||
<Popover targetClass="h-8" openOnHover>
|
||||
<div
|
||||
class=" flex items-center text-sm gap-1 rounded-md border border-slate-200
|
||||
dark:border-zinc-700 px-1 h-8 duration-200 dark:bg-zinc-900"
|
||||
slot="target"
|
||||
<div
|
||||
class=" flex items-center text-sm gap-1 rounded-md border border-slate-200
|
||||
dark:border-zinc-800 bg-white dark:bg-zinc-900 px-1 h-8 cursor-pointer"
|
||||
>
|
||||
<Button
|
||||
aria-label="Upvote"
|
||||
class={vote == 1 ? voteColor(vote) : ''}
|
||||
on:click={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
vote = vote == 1 ? 0 : 1
|
||||
score = await voteItem(post, vote, $profile.jwt)
|
||||
}}
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
alignment="center"
|
||||
>
|
||||
<Button
|
||||
aria-label="Upvote"
|
||||
class={vote == 1 ? voteColor(vote) : ''}
|
||||
on:click={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
vote = vote == 1 ? 0 : 1
|
||||
score = await voteItem(post, vote, $profile.jwt)
|
||||
}}
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
alignment="center"
|
||||
>
|
||||
<Icon src={ChevronUp} mini size="18" />
|
||||
</Button>
|
||||
<span
|
||||
class="font-medium transition-colors duration-200 {voteColor(vote)}"
|
||||
>
|
||||
<FormattedNumber number={score} />
|
||||
</span>
|
||||
<Button
|
||||
aria-label="Downvote"
|
||||
class={vote == -1 ? voteColor(vote) : ''}
|
||||
on:click={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
vote = vote == -1 ? 0 : -1
|
||||
score = await voteItem(post, vote, $profile.jwt)
|
||||
}}
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
>
|
||||
<Icon src={ChevronDown} mini size="18" />
|
||||
</Button>
|
||||
</div>
|
||||
<div class="flex flex-row items-center gap-2">
|
||||
<span class="flex items-center gap-1 text-blue-500 font-medium">
|
||||
<Icon src={ArrowUp} mini size="18" />
|
||||
<FormattedNumber number={upvotes} />
|
||||
</span>
|
||||
<span class="flex items-center gap-1 text-red-500 font-medium">
|
||||
<Icon src={ArrowDown} mini size="18" />
|
||||
<FormattedNumber number={downvotes} />
|
||||
</span>
|
||||
</div>
|
||||
</Popover>
|
||||
<Icon src={ChevronUp} mini size="18" />
|
||||
</Button>
|
||||
<span class="font-medium transition-colors duration-200 {voteColor(vote)}">
|
||||
<FormattedNumber number={score} />
|
||||
</span>
|
||||
<Button
|
||||
aria-label="Downvote"
|
||||
class={vote == -1 ? voteColor(vote) : ''}
|
||||
on:click={async () => {
|
||||
if (!$profile?.jwt) return
|
||||
vote = vote == -1 ? 0 : -1
|
||||
score = await voteItem(post, vote, $profile.jwt)
|
||||
}}
|
||||
size="square-sm"
|
||||
color="tertiary"
|
||||
>
|
||||
<Icon src={ChevronDown} mini size="18" />
|
||||
</Button>
|
||||
</div>
|
||||
</slot>
|
||||
Reference in new issue
Block a user