design: use btn-primary for vote colors
This commit is contained in:
3 files changed
+20
-4
No files matched your search
@@ -28,6 +28,7 @@
|
|||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
|
|
||||||
const castVote = async (newVote: number) => {
|
const castVote = async (newVote: number) => {
|
||||||
|
if (navigator.vibrate) navigator.vibrate(1)
|
||||||
if (!profile.current?.jwt) {
|
if (!profile.current?.jwt) {
|
||||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||||
return
|
return
|
||||||
@@ -82,7 +83,7 @@
|
|||||||
vote,
|
vote,
|
||||||
target == 'upvote' ? 'upvotes' : 'downvotes',
|
target == 'upvote' ? 'upvotes' : 'downvotes',
|
||||||
)
|
)
|
||||||
: 'hover:bg-slate-100 dark:hover:bg-zinc-800',
|
: 'btn-tertiary',
|
||||||
]}
|
]}
|
||||||
aria-pressed={vote == targetNum}
|
aria-pressed={vote == targetNum}
|
||||||
aria-label={$t(
|
aria-label={$t(
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
<script lang="ts" module>
|
<script lang="ts" module>
|
||||||
export const voteColor = (vote: number) =>
|
export const voteColor = (vote: number) =>
|
||||||
vote == 1
|
vote == 1
|
||||||
? `bg-primary-900 dark:bg-primary-100 text-slate-50 dark:text-zinc-900`
|
? `btn-primary border-0!`
|
||||||
: vote == -1
|
: vote == -1
|
||||||
? `bg-red-500 text-slate-50 dark:bg-red-400 dark:text-zinc-900`
|
? `bg-red-500 text-slate-50 dark:bg-red-400 dark:text-zinc-900`
|
||||||
: ''
|
: ''
|
||||||
@@ -50,6 +50,7 @@
|
|||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
|
|
||||||
const castVote = async (newVote: number) => {
|
const castVote = async (newVote: number) => {
|
||||||
|
if (navigator.vibrate) navigator.vibrate(1)
|
||||||
if (!profile.current?.jwt) {
|
if (!profile.current?.jwt) {
|
||||||
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
toast({ content: $t('toast.loginVoteGate'), type: 'warning' })
|
||||||
return
|
return
|
||||||
@@ -92,7 +93,7 @@
|
|||||||
<button
|
<button
|
||||||
onclick={() => castVote(vote == targetNum ? 0 : targetNum)}
|
onclick={() => castVote(vote == targetNum ? 0 : targetNum)}
|
||||||
class={[
|
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]',
|
'first:rounded-l-[inherit] last:rounded-r-[inherit]',
|
||||||
'last:flex-row-reverse',
|
'last:flex-row-reverse',
|
||||||
vote == targetNum
|
vote == targetNum
|
||||||
@@ -100,7 +101,7 @@
|
|||||||
vote,
|
vote,
|
||||||
target == 'upvote' ? 'upvotes' : 'downvotes',
|
target == 'upvote' ? 'upvotes' : 'downvotes',
|
||||||
)
|
)
|
||||||
: 'hover:bg-slate-100 dark:hover:bg-zinc-800',
|
: 'btn-tertiary',
|
||||||
]}
|
]}
|
||||||
aria-pressed={vote == targetNum}
|
aria-pressed={vote == targetNum}
|
||||||
aria-label={$t(
|
aria-label={$t(
|
||||||
|
|||||||
@@ -210,6 +210,13 @@
|
|||||||
filter: brightness(90%);
|
filter: brightness(90%);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@variant active {
|
||||||
|
filter: brightness(95%);
|
||||||
|
@variant dark {
|
||||||
|
filter: brightness(85%);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-secondary {
|
.btn-secondary {
|
||||||
@@ -290,6 +297,10 @@
|
|||||||
background-color: var(--color-slate-100);
|
background-color: var(--color-slate-100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@variant active {
|
||||||
|
background-color: --alpha(var(--color-slate-200) / 75%);
|
||||||
|
}
|
||||||
|
|
||||||
@variant dark {
|
@variant dark {
|
||||||
border-color: var(--color-zinc-800);
|
border-color: var(--color-zinc-800);
|
||||||
@variant hover {
|
@variant hover {
|
||||||
@@ -297,6 +308,9 @@
|
|||||||
border-color: var(--color-zinc-700);
|
border-color: var(--color-zinc-700);
|
||||||
color: var(--color-zinc-200);
|
color: var(--color-zinc-200);
|
||||||
}
|
}
|
||||||
|
@variant active {
|
||||||
|
background-color: var(--color-zinc-900);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user