import React, { memo, useEffect, useState } from "react"; import NrcNosearchPick from "../../NosearchPick"; import Button from "../../UI/Button"; import Heading from "../../UI/Heading"; import { BookmarkDefault, BookmarkPressed, Caret, ComparisonDefault, ComparisonPressed, } from "../../UI/Icon"; import Text from "../../UI/Text"; import Link from "../../shared/Link"; import TextElement from "../Text"; import { IPickProductWithRadarChartProps } from "./PickProductWithRadarChart.types"; const PickProductWithRadarChart = ({ titleKey, title, productData: { productId, parentCategory, productCategory, modelName, productName, brandName, thumbnailUrl, price, colors, pickType, scoreMetaMap, twoLineSummary, summary, scrapStatus, compareStatus, reviewAverage, reviewCount, onScrapButtonClick, onCompareButtonClick, }, editorContent, showTitle = true, verticalProductInformation = true, showProductInformation = true, showActionButtonsOnInformation = true, showChart = true, showNosearchTwoLines = true, showSummary = false, showContent = true, defaultContentCollapsed = false, showRedirectDetailPageButton = true, redirectDetailPageButtonText = "더 자세한 리뷰 확인하기", showPurchaseOptionButton = false, purchaseOptionButtonText = "최저가 구매하기", showTipModalButton = false, tipModalText = "", onProductClick: handleProductClick, onPurchaseOptionButtonClick: handlePurchaseOptionButtonClick, onTipButtonClick: handleTipButtonClick, onSpecDetailButtonClick: handleSpecDetailButtonClick, NewTabLink, isMobile = true, PickProductV2Component, }: IPickProductWithRadarChartProps) => { const encodedModelName = encodeURIComponent(modelName); const [isContentCollapsed, setIsContentCollapsed] = useState( defaultContentCollapsed ); useEffect(() => { setIsContentCollapsed(defaultContentCollapsed); }, [defaultContentCollapsed]); return (
{showTitle && (
{titleKey}
{title}
{!showActionButtonsOnInformation && (
{onScrapButtonClick && (
{scrapStatus ? ( ) : ( )}
)} {onCompareButtonClick && (
{compareStatus ? ( ) : ( )}
)}
)}
)}
{ const target = e.target as HTMLElement; const tagName = target.tagName; const textContent = target.textContent; if ( !handleProductClick || tagName === "svg" || tagName === "path" || (tagName === "P" && textContent === "비교함") ) { return; } handleProductClick(); }} > {showProductInformation && (PickProductV2Component ?? ( ))}
{showNosearchTwoLines && twoLineSummary !== "" && (

{twoLineSummary}

)}
{showSummary && summary !== "" && ( )} {showContent && ( )} {showTipModalButton && (

{tipModalText}

)}
{showPurchaseOptionButton && ( )} {showRedirectDetailPageButton && ( )}
); }; export default memo(PickProductWithRadarChart);