design: use btn-primary for vote colors

This commit is contained in:
Xylight committed 2025-11-27 13:56:11 -08:00
1 parent 86fabfaf66
commit bac6e66ac5
3 files changed
+20 -4

No files matched your search

+2 -1
View File
@@ -28,6 +28,7 @@
}: Props = $props()
const castVote = async (newVote: number) => {
if (navigator.vibrate) navigator.vibrate(1)
if (!profile.current?.jwt) {
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
return
@@ -82,7 +83,7 @@
vote,
target == 'upvote' ? 'upvotes' : 'downvotes',
)
: 'hover:bg-slate-100 dark:hover:bg-zinc-800',
: 'btn-tertiary',
]}
aria-pressed={vote == targetNum}
aria-label={$t(
+4 -3
View File
@@ -1,7 +1,7 @@
<script lang="ts" module>
export const voteColor = (vote: number) =>
vote == 1
? `bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900`
? `btn-primary border-0!`
: vote == -1
? `bg-red-500 text-slate-50 dark:bg-red-400 dark:text-zinc-900`
: ''
@@ -50,6 +50,7 @@
}: Props = $props()
const castVote = async (newVote: number) => {
if (navigator.vibrate) navigator.vibrate(1)
if (!profile.current?.jwt) {
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
return
@@ -92,7 +93,7 @@
<button
onclick={() => castVote(vote == targetNum ? 0 : targetNum)}
class={[
'flex items-center gap-0.5 transition-colors relative cursor-pointer h-full p-2 active:brightness-90',
'flex items-center gap-0.5 transition-colors relative cursor-pointer h-full p-2',
'first:rounded-l-[inherit] last:rounded-r-[inherit]',
'last:flex-row-reverse',
vote == targetNum
@@ -100,7 +101,7 @@
vote,
target == 'upvote' ? 'upvotes' : 'downvotes',
)
: 'hover:bg-slate-100 dark:hover:bg-zinc-800',
: 'btn-tertiary',
]}
aria-pressed={vote == targetNum}
aria-label={$t(
+14
View File
@@ -210,6 +210,13 @@
filter: brightness(90%);
}
}
@variant active {
filter: brightness(95%);
@variant dark {
filter: brightness(85%);
}
}
}
.btn-secondary {
@@ -290,6 +297,10 @@
background-color: var(--color-slate-100);
}
@variant active {
background-color: --alpha(var(--color-slate-200) / 75%);
}
@variant dark {
border-color: var(--color-zinc-800);
@variant hover {
@@ -297,6 +308,9 @@
border-color: var(--color-zinc-700);
color: var(--color-zinc-200);
}
@variant active {
background-color: var(--color-zinc-900);
}
}
}