// Generated with util/create-component.js import React from "react"; import Label from "../Label"; import NsImage from "../shared/ns-image"; import Timer from "../Timer"; import Heading from "../UI/Heading"; import Text from "../UI/Text"; import { NosearchDealProps } from "./NosearchDeal.types"; const NosearchDeal: React.FC = (props) => { const { data, viewType, fluid, type = "nosearchDeal", isLogin = false, isIOSApp = false, } = props; let state: | "NOSEARCH_DEAL" | "REVIEWTEM" | "MEMBERSHIP" | "SOLDOUT" | "MEMBERSHIP-SOLDOUT" = "NOSEARCH_DEAL"; const itemState = () => { if (type === "reviewTem") state = "REVIEWTEM"; if (type === "nosearchDeal") state = "NOSEARCH_DEAL"; if (!isLogin && data.goodsAccess === "member") state = "MEMBERSHIP"; if (data.soldOutFl === "y") state = "SOLDOUT"; if (!isLogin && data.goodsAccess === "member" && data.soldOutFl === "y") state = "MEMBERSHIP-SOLDOUT"; return state; }; const imageSize = fluid ? `w-full max-w-[33.5rem] ${ viewType === "home" ? "pc:max-w-[48rem]" : "pc:max-w-[38rem]" }` : `w-[33.5rem] ${viewType === "home" ? "pc:w-[48rem]" : "pc:w-[38rem]"}`; return (
{type === "nosearchDeal" && !data.isComingSoon && ( )}
{(type === "nosearchDeal" || viewType === "pick") && (
)}
{itemState() === "REVIEWTEM" && (
{data.hasSpecialPrice && ( )} {data.hasCouponDiscount && ( )}
)} {/* PC Label */} {itemState() === "NOSEARCH_DEAL" && ( )} {(itemState() === "SOLDOUT" || itemState() === "MEMBERSHIP-SOLDOUT") && ( )} {itemState() === "MEMBERSHIP" && ( )} {itemState() === "MEMBERSHIP" || itemState() === "MEMBERSHIP-SOLDOUT" ? ( 시크릿 특가 확인하기 ) : (

{numberWithCommas(data.discountedPrice)}원

{!data.isComingSoon && ( {numberWithCommas(data.originPrice)}원 )}
)} {/* Mobile Label */} {itemState() === "NOSEARCH_DEAL" && ( )} {(itemState() === "SOLDOUT" || itemState() === "MEMBERSHIP-SOLDOUT") && ( )} {itemState() === "MEMBERSHIP" && ( )}
); }; export default NosearchDeal; const numberWithCommas = (num: number): string => { if (!num) return ""; return num.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","); }; const ProductImage = (props: { imageSize: string; video?: string; videoThumbnail?: string; comingSoonImg?: string; isComingSoon: boolean; ImageWrapper?: JSX.Element; startAt: string; isIOSApp?: boolean; videoKey: string; }) => { const { imageSize, video, videoThumbnail, comingSoonImg, isComingSoon, ImageWrapper, startAt, isIOSApp, videoKey, } = props; const COMING_SOON_IMG = (
coming soon {startAt && startAt.substring(0, 10).replace(/-/g, ".")} 14:00 OPEN
); const VIDEO = ( ); return isComingSoon ? ( COMING_SOON_IMG ) : (
{ if (isIOSApp) e.preventDefault(); }} > {VIDEO}
); };