migrate: convert most components to svelte 5
This commit is contained in:
1 parent
d670f39f0a
commit
10ef4123da
225 files changed
+5441
-3341
No files matched your search
@@ -18,10 +18,19 @@
|
||||
import { backOut } from 'svelte/easing'
|
||||
import { t } from '$lib/translations'
|
||||
|
||||
export let vote: number = 0
|
||||
export let upvotes: number
|
||||
export let downvotes: number
|
||||
export let commentId: number
|
||||
interface Props {
|
||||
vote?: number
|
||||
upvotes: number
|
||||
downvotes: number
|
||||
commentId: number
|
||||
}
|
||||
|
||||
let {
|
||||
vote = $bindable(0),
|
||||
upvotes = $bindable(),
|
||||
downvotes = $bindable(),
|
||||
commentId,
|
||||
}: Props = $props()
|
||||
|
||||
const castVote = async (newVote: number) => {
|
||||
if (!$profile?.jwt) {
|
||||
@@ -42,7 +51,7 @@
|
||||
class="h-full flex items-center overflow-hidden {buttonColor.ghost} rounded-full hover:bg-transparent"
|
||||
>
|
||||
<button
|
||||
on:click={() => castVote(vote == 1 ? 0 : 1)}
|
||||
onclick={() => castVote(vote == 1 ? 0 : 1)}
|
||||
class="flex items-center gap-0.5 transition-colors px-1.5 h-full
|
||||
{vote == 1
|
||||
? shouldShowVoteColor(vote, 'upvotes')
|
||||
@@ -65,7 +74,7 @@
|
||||
class="border-l h-4 w-0 !p-0 border-slate-200 dark:border-zinc-800"
|
||||
></div>
|
||||
<button
|
||||
on:click={() => castVote(vote == -1 ? 0 : -1)}
|
||||
onclick={() => castVote(vote == -1 ? 0 : -1)}
|
||||
class="flex flex-row-reverse items-center gap-0.5 h-full transition-colors border-0 px-1.5
|
||||
{vote == -1
|
||||
? shouldShowVoteColor(vote, 'downvotes')
|
||||
|
||||
Reference in new issue
Block a user