From a2304dc9b8d242599f62b4a1eae312a4a4568513 Mon Sep 17 00:00:00 2001 From: Terence Ho <> Date: Fri, 21 Oct 2022 11:51:53 +0800 Subject: [PATCH] [resumes][feat] add collapsible comments --- .../comments/ResumeCommentListItem.tsx | 46 +++++++++++-------- 1 file changed, 27 insertions(+), 19 deletions(-) diff --git a/apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx b/apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx index c20930cf..36299b2a 100644 --- a/apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx +++ b/apps/portal/src/components/resumes/comments/ResumeCommentListItem.tsx @@ -1,5 +1,6 @@ import clsx from 'clsx'; import { useState } from 'react'; +import { ChevronUpIcon } from '@heroicons/react/20/solid'; import { FaceSmileIcon } from '@heroicons/react/24/outline'; import ResumeCommentEditForm from './comment/ResumeCommentEditForm'; @@ -22,6 +23,7 @@ export default function ResumeCommentListItem({ const isCommentOwner = userId === comment.user.userId; const [isEditingComment, setIsEditingComment] = useState(false); const [isReplyingComment, setIsReplyingComment] = useState(false); + const [showReplies, setShowReplies] = useState(true); return (

{comment.user.name ?? 'Reviewer ABC'} @@ -126,24 +128,30 @@ export default function ResumeCommentListItem({ {/* Replies */} {comment.children.length > 0 && ( // Horizontal Divider -

-
-
- - Replies - -
-
- - {comment.children.map((child) => { - return ( - - ); - })} +
+ + + {showReplies && + comment.children.map((child) => { + return ( + + ); + })}
)}