From 3558bd9711513a35e8473c71be3769b8a5aeccb1 Mon Sep 17 00:00:00 2001 From: hanseo Date: Thu, 5 Sep 2024 20:33:15 +0900 Subject: [PATCH] =?UTF-8?q?code=20review:=20naming=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/shared/components/CategoryCommonMoribSet.tsx | 13 ++++++++----- src/shared/components/CategoryModalLeft.tsx | 10 +++++----- src/shared/components/CategoryTabSelect.tsx | 6 +++--- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/src/shared/components/CategoryCommonMoribSet.tsx b/src/shared/components/CategoryCommonMoribSet.tsx index cc4a8d65..dc8acf0b 100644 --- a/src/shared/components/CategoryCommonMoribSet.tsx +++ b/src/shared/components/CategoryCommonMoribSet.tsx @@ -50,6 +50,13 @@ const CategoryCommonMoribSet = ({ variant, urlInfos, children }: CategoryCommonM const theadStyle = ' detail-semibold-14 flex h-[4.6rem] items-center border-b-[0.1rem] border-gray-bg-04 text-gray-04'; + const renderEmptyRows = (count: number) => { + return Array.from({ length: count }).map((_, index) => ( +
+ )); + }; + + const emptyRowCount = Math.max(sizeVariant[variant].rowCounts - urlInfos.length, 0); return (
{children} - {Array.from({ length: Math.max(sizeVariant[variant].rowCounts - urlInfos.length, 0) }, (_, index) => ( -
-
-
- ))} + {renderEmptyRows(emptyRowCount)}
diff --git a/src/shared/components/CategoryModalLeft.tsx b/src/shared/components/CategoryModalLeft.tsx index e723b6bf..39345e15 100644 --- a/src/shared/components/CategoryModalLeft.tsx +++ b/src/shared/components/CategoryModalLeft.tsx @@ -35,7 +35,7 @@ const CategoryModalLeft = ({ isClicked, selectedOption, }: ModalProps) => { - const [isSelectedTab, setSelectedTab] = useState(CATEGORY_MODALTABS[0].id); + const [selectedTabId, setSelectedTabId] = useState(CATEGORY_MODALTABS[0].id); const { data: categoryData } = useCategoryLists(); const categories = categoryData?.data || []; @@ -49,10 +49,10 @@ const CategoryModalLeft = ({ }; const handleTabChange = (tab: number) => { - setSelectedTab(tab); + setSelectedTabId(tab); }; - const disabled = isSelectedTab === 2; + const disabled = selectedTabId === 2; return (
@@ -60,7 +60,7 @@ const CategoryModalLeft = ({

카테고리 추가