import React, { memo } from "react"; import ColorChips from "../../ColorChips"; import PickLabel from "../../PickLabel"; import { Caret } from "../../UI/Icon"; import Text from "../../UI/Text"; import Link from "../../shared/Link"; import { IProductCompareTableHighlightedTableProps } from "./ProductCompareTable.types"; const ProductCompareTableHighlightedTable = ({ parentCategory, productCategory, productMap, productModelNameList, specCategoryNameList, showProductInforamtionRow, highlightedProductModelName, highlightedSpecName, Image, NewTabLink, }: IProductCompareTableHighlightedTableProps) => { return ( {/* product info */} {showProductInforamtionRow && ( {productModelNameList.map((modelName) => { if (!productMap[modelName]) { return; } const isColumnHighlighted = highlightedProductModelName === modelName; const { pickType, imageUrl, specCategoryMap, showDetailButton = true, } = productMap[modelName]; return ( ); })} )} {/* product spec data */} {specCategoryNameList?.map((specCategoryName, index) => { const isRowHighlighted = highlightedSpecName === specCategoryName; return ( {productModelNameList.map((modelName) => { if (!productMap[modelName]) { return; } const { specCategoryMap } = productMap[modelName]; if (!specCategoryMap[specCategoryName]) { return; } const { value, unit, prefix, postfix } = specCategoryMap[ specCategoryName ]; const isColHighlighted = highlightedProductModelName === modelName; const isLastRow = specCategoryNameList.length - 1 === index; return ( <> ); })} ); })}
제품 정보
{Image ? ( {modelName} ) : ( {modelName} )}
{specCategoryMap["브랜드"] && specCategoryMap["브랜드"].value} {["제품명", "모델명", "가격대"].map((specName) => { return ( {specCategoryMap[specName] && specCategoryMap[specName].value} {specName === "가격대" && "만~"} ); })} {showDetailButton && (
자세히 보기
)}
{specCategoryName}
{specCategoryName === "색상" ? (
) : ( {value === "-" ? "-" : `${prefix ?? ""} ${value} ${unit ?? postfix ?? ""}`} )}
); }; export default memo(ProductCompareTableHighlightedTable);