From 57e52c9a14b83253d23775580e287d9ce7f7e551 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cspicecat=E2=80=9D?= Date: Thu, 18 Aug 2022 17:12:00 -0400 Subject: [PATCH] accepted answer chip --- client/src/components/ListQuestion.jsx | 6 ++-- client/src/components/ListQuestionInfo.jsx | 33 ++++++++++++++++------ 2 files changed, 26 insertions(+), 13 deletions(-) diff --git a/client/src/components/ListQuestion.jsx b/client/src/components/ListQuestion.jsx index 3ae30a0..05dda16 100644 --- a/client/src/components/ListQuestion.jsx +++ b/client/src/components/ListQuestion.jsx @@ -20,7 +20,7 @@ export default function ListQuestion({ }) { const sm = useMediaQuery((theme) => theme.breakpoints.only('sm')); const md = useMediaQuery((theme) => theme.breakpoints.only('md')); - console.log(123123, tags) + return ( @@ -31,7 +31,7 @@ export default function ListQuestion({ - {sm || md ? null : } + {sm || md ? null : } {text.replace(/<[^>]*>?/gm, '')} - Accepted: {String(hasAcceptedAnswer)} - diff --git a/client/src/components/ListQuestionInfo.jsx b/client/src/components/ListQuestionInfo.jsx index 57c1a87..e61cc4e 100644 --- a/client/src/components/ListQuestionInfo.jsx +++ b/client/src/components/ListQuestionInfo.jsx @@ -1,16 +1,31 @@ -import { Typography } from "@mui/material" -export default function ListQuestionInfo({upvotes, downvotes, answers, views, inline}){ - return inline? ( +import { Chip, Typography } from '@mui/material'; +export default function ListQuestionInfo({ upvotes, downvotes, answers, hasAcceptedAnswer, views, inline }) { + return inline ? ( <> - {upvotes - downvotes} votes | - {answers} answers | - {views} views + {upvotes - downvotes} votes | + {answers} answers | + {views} views + + Accepted: + + ) : ( <> - {upvotes - downvotes} votes - {answers} answers - {views} views + {upvotes - downvotes} votes + {answers} answers + {views} views + + Accepted: + ) } \ No newline at end of file