-
-
-
+
+
+
-
- Comment placeholder
-
-
-
-
-
{question.answerCount} answers
-
-
- Sort by:
-
-
-
-
+
+
+
+ Sort by:
+
+
+
+
+
+
+
- {Array.from({ length: question.answerCount }).map((_, index) => (
-
- ))}
+ {Array.from({ length: question.commentCount }).map((_, index) => (
+
+ ))}
+
diff --git a/apps/portal/src/pages/questions/[questionId]/[questionSlug]/index.tsx b/apps/portal/src/pages/questions/[questionId]/[questionSlug]/index.tsx
index debcdbe7..74253d6a 100644
--- a/apps/portal/src/pages/questions/[questionId]/[questionSlug]/index.tsx
+++ b/apps/portal/src/pages/questions/[questionId]/[questionSlug]/index.tsx
@@ -5,24 +5,41 @@ import { Button, Collapsible, Select, TextArea } from '@tih/ui';
import AnswerCard from '~/components/questions/card/AnswerCard';
import FullQuestionCard from '~/components/questions/card/FullQuestionCard';
+import CommentListItem from '~/components/questions/CommentListItem';
-import { SAMPLE_QUESTION } from '~/utils/questions/constants';
+import {
+ SAMPLE_ANSWER,
+ SAMPLE_QUESTION,
+ SAMPLE_QUESTION_COMMENT,
+} from '~/utils/questions/constants';
import { useFormRegister } from '~/utils/questions/useFormRegister';
export type AnswerQuestionData = {
answerContent: string;
};
+export type QuestionCommentData = {
+ commentContent: string;
+};
+
export default function QuestionPage() {
const router = useRouter();
const {
- register: formRegister,
+ register: ansRegister,
handleSubmit,
formState: { isDirty, isValid },
} = useForm
({ mode: 'onChange' });
- const register = useFormRegister(formRegister);
- const question = SAMPLE_QUESTION;
+ const answerRegister = useFormRegister(ansRegister);
+ const {
+ register: comRegister,
+ handleSubmit: handleCommentSubmit,
+ formState: { isDirty: isCommentDirty, isValid: isCommentValid },
+ } = useForm({ mode: 'onChange' });
+ const commentRegister = useFormRegister(comRegister);
+
+ const question = SAMPLE_QUESTION;
+ const comment = SAMPLE_QUESTION_COMMENT;
const handleBackNavigation = () => {
router.back();
};
@@ -32,8 +49,13 @@ export default function QuestionPage() {
console.log(data);
};
+ const handleSubmitComment = (data: QuestionCommentData) => {
+ // eslint-disable-next-line no-console
+ console.log(data);
+ };
+
return (
-
+
-
-
+
+
-
- Comment placeholder
+
+
+
+ {Array.from({ length: question.commentCount }).map((_, index) => (
+
+ ))}