From a72fef25514005035bb7453db6764520181e68f8 Mon Sep 17 00:00:00 2001 From: Andreas Thomas Date: Tue, 13 Dec 2022 09:05:26 +0100 Subject: [PATCH] feat: down vote button and styling fixs * added down vote button * onVote function changed to handle up and down vote * fixed in dark mode the text color of the theme switcher options * added mounted check to header component to prevent state update on unmounted component --- components/card-active.tsx | 65 ++++++++++++++++++++++++-------------- components/footer.tsx | 2 +- components/header.tsx | 6 ++++ pages/api/remove.ts | 2 -- pages/api/vote.ts | 24 ++++++++++++-- store/index.tsx | 18 ++++++++--- styles/globals.css | 4 +++ 7 files changed, 89 insertions(+), 32 deletions(-) diff --git a/components/card-active.tsx b/components/card-active.tsx index f80482b..c1bf3d1 100644 --- a/components/card-active.tsx +++ b/components/card-active.tsx @@ -1,6 +1,6 @@ import { DateTime } from 'luxon' import { useContext } from 'react' -import GlobalStoreContext, { Feature } from '@/store/index' +import GlobalStoreContext, { Feature, VoteType } from '@/store/index' import { useSession } from 'next-auth/react' export default function CardActive({ item }: { item: Feature }) { @@ -12,29 +12,48 @@ export default function CardActive({ item }: { item: Feature }) { const isAdmin = session?.user['role'] === 'admin' return ( -
- + + + + + +
{score}
+ + +

{title}

diff --git a/components/footer.tsx b/components/footer.tsx index fed73ca..7cf90e8 100644 --- a/components/footer.tsx +++ b/components/footer.tsx @@ -21,7 +21,7 @@ export default function Footer() {