Vote imporvements

This commit is contained in:
mrfry 2021-05-04 18:12:12 +02:00
parent d22e20b79e
commit 5611fd8d66
2 changed files with 25 additions and 21 deletions

View file

@ -9,6 +9,7 @@ export default function UpDownVote({
upvotes,
downvotes,
userId,
disabled,
}) {
const upvoted = upvotes.includes(userId)
const downvoted = downvotes.includes(userId)
@ -19,6 +20,9 @@ export default function UpDownVote({
className={styles.action}
onClick={(e) => {
e.stopPropagation()
if (disabled) {
return
}
if (!upvoted) {
onUp()
} else {
@ -33,6 +37,9 @@ export default function UpDownVote({
className={styles.action}
onClick={(e) => {
e.stopPropagation()
if (disabled) {
return
}
if (!downvoted) {
onDown()
} else {