feat: Add option to revert vote colors

This commit is contained in:
Xyphyn committed 2023-07-17 13:27:06 -07:00
1 parent adc3df0d8f
commit 75671f3fad
7 files changed
+50 -10

No files matched your search

+5 -2
View File
@@ -1,6 +1,7 @@
<script lang="ts">
import FormattedNumber from '$lib/components/util/FormattedNumber.svelte'
import { authData, getClient } from '$lib/lemmy'
import { userSettings } from '$lib/settings.js'
import { Color } from '$lib/ui/colors.js'
import type { Post } from 'lemmy-js-client'
import { ChevronDown, ChevronUp, Icon } from 'svelte-hero-icons'
@@ -71,7 +72,8 @@
>
<button
aria-label="Upvote"
class:text-orange-500={vote == 1}
class:text-orange-500={vote == 1 && $userSettings.revertColors}
class:text-blue-500={vote == 1 && !$userSettings.revertColors}
class="p-0.5 px-1"
on:click={upvote}
>
@@ -80,7 +82,8 @@
<FormattedNumber number={score} />
<button
aria-label="Downvote"
class:text-blue-500={vote == -1}
class:text-blue-500={vote == -1 && $userSettings.revertColors}
class:text-red-500={vote == -1 && !$userSettings.revertColors}
class="p-0.5 px-1"
on:click={downvote}
>
@@ -65,7 +65,11 @@
>
<button
on:click={upvote}
class="px-1.5 {vote == 1 ? 'text-orange-500' : ''}"
class="px-1.5 {vote == 1
? $userSettings.revertColors
? 'text-orange-500'
: 'dark:text-blue-500 text-blue-600'
: ''}"
aria-label="Upvote"
>
<Icon src={ChevronUp} width={19} mini />
@@ -75,7 +79,11 @@
</span>
<button
on:click={downvote}
class="px-1.5 {vote == -1 ? 'text-blue-500' : ''}"
class="px-1.5 {vote == -1
? $userSettings.revertColors
? 'dark:text-blue-500 text-blue-600'
: 'text-red-400'
: ''}"
aria-label="Downvote"
>
<Icon src={ChevronDown} width={19} mini />