From e22589077ab81d782dc218e23313081dd738463d Mon Sep 17 00:00:00 2001 From: 2yunseong Date: Thu, 19 Sep 2024 06:14:09 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20=EC=A4=91=EB=B3=B5=EB=90=A0=20=EC=88=98?= =?UTF-8?q?=20=EC=9E=88=EB=8A=94=20key=EA=B0=92=EC=9D=B4=20=EC=A1=B4?= =?UTF-8?q?=EC=9E=AC=ED=95=98=EB=AF=80=EB=A1=9C,=20=EC=9E=AC=EC=A1=B0?= =?UTF-8?q?=EC=A0=95=EC=9D=B4=20=EC=8B=A4=ED=8C=A8=ED=95=98=EB=8A=94=20?= =?UTF-8?q?=EB=AC=B8=EC=A0=9C=20=ED=95=B4=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../applicantNode/Label.component.tsx | 31 +++++++------------ .../kanban/content/work/Label.component.tsx | 31 +++++++------------ frontend/src/apis/applicant/index.ts | 7 ++++- frontend/src/apis/work/index.ts | 5 ++- 4 files changed, 32 insertions(+), 42 deletions(-) diff --git a/frontend/components/applicant/applicantNode/Label.component.tsx b/frontend/components/applicant/applicantNode/Label.component.tsx index 0329265d..076bad0b 100644 --- a/frontend/components/applicant/applicantNode/Label.component.tsx +++ b/frontend/components/applicant/applicantNode/Label.component.tsx @@ -18,7 +18,7 @@ interface ApplicantLabelProps { const ApplicantLabel = ({ postId, generation }: ApplicantLabelProps) => { const [openAdditional, setOpenAdditional] = useState(false); - const { data, error, isLoading } = useQuery( + const { data, error, isLoading } = useQuery( ["applicantLabel", postId], () => getApplicantLabel(postId), { @@ -38,6 +38,8 @@ const ApplicantLabel = ({ postId, generation }: ApplicantLabelProps) => { setOpenAdditional((prev) => !prev); }; + const omitLabels = openAdditional ? data : data.slice(0, 6); + return (
@@ -48,25 +50,14 @@ const ApplicantLabel = ({ postId, generation }: ApplicantLabelProps) => {
- {openAdditional - ? data.map((label) => ( - - )) - : data - .map((label) => ( - - )) - .slice(0, 6)} + {omitLabels.map((label) => ( + + ))}