diff --git a/frontend/src/pages/Q&A/Q&A.jsx b/frontend/src/pages/Q&A/Q&A.jsx index 686f1522..d9d2e1bb 100644 --- a/frontend/src/pages/Q&A/Q&A.jsx +++ b/frontend/src/pages/Q&A/Q&A.jsx @@ -123,10 +123,12 @@ function Ques(props) { }; const [getQuestions, setQuestions] = useState([]); - const fetchQuestions = () => { getAllQuestion(setToast).then((data) => { setLoading(false); + data = data.map((item) => { + return { ...item, tags: item.tags[0] }; + }); setQuestions(data); }); }; @@ -154,38 +156,48 @@ function Ques(props) { ) : (
- {getQuestions.map((item, key) => ( -
-
-

{item.title}

-

{item.description}

- {item.tags.map((i, key) => ( - - #{i} - - ))} -
-
-
-

Created At {new Date(item.createdAt).toLocaleString()}

+ {getQuestions?.map((item, key) => { + let tags = [...Object.values(item.tags)]; + return ( +
+
+

{item.title}

+

{item.description}

+
+ {tags.map((i, index) => { + if (i == true) + return ( + + {i === true ? `#${Tags[index].value}` : ""} + + ); + })} +
-
- - +
+
+

+ Created At {new Date(item.createdAt).toLocaleString()} +

+
+
+ + +
-
- ))} + ); + })}
)} diff --git a/frontend/src/pages/Q&A/Ques.scss b/frontend/src/pages/Q&A/Ques.scss index 943c3016..6b531ff6 100644 --- a/frontend/src/pages/Q&A/Ques.scss +++ b/frontend/src/pages/Q&A/Ques.scss @@ -16,6 +16,19 @@ align-content: center; } +.tags-container { + width: 100%; + display: flex; + flex-direction: row; + flex-wrap: wrap; + justify-content: flex-start; + gap: 10px; +} + +.tag-space { + width: fit-content; +} + .close-popup { color: black; background: #69a9dd;