|
|
|
|
@@ -1,9 +1,32 @@
|
|
|
|
|
import React, { useCallback } from "react";
|
|
|
|
|
import css from "./ProductDescription.module.less";
|
|
|
|
|
import { $L, removeSpecificTags } from "../../../../utils/helperMethods";
|
|
|
|
|
import Spottable from "@enact/spotlight/Spottable";
|
|
|
|
|
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
|
|
|
|
import Spotlight from "@enact/spotlight";
|
|
|
|
|
import React, {
|
|
|
|
|
useCallback,
|
|
|
|
|
useMemo,
|
|
|
|
|
} from 'react';
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
useDispatch,
|
|
|
|
|
useSelector,
|
|
|
|
|
} from 'react-redux';
|
|
|
|
|
|
|
|
|
|
import Spotlight from '@enact/spotlight';
|
|
|
|
|
import SpotlightContainerDecorator
|
|
|
|
|
from '@enact/spotlight/SpotlightContainerDecorator';
|
|
|
|
|
import Spottable from '@enact/spotlight/Spottable';
|
|
|
|
|
|
|
|
|
|
import {
|
|
|
|
|
setHidePopup,
|
|
|
|
|
setShowPopup,
|
|
|
|
|
} from '../../../../actions/commonActions';
|
|
|
|
|
import TButtonScroller
|
|
|
|
|
from '../../../../components/TButtonScroller/TButtonScroller';
|
|
|
|
|
import TNewPopUp from '../../../../components/TPopUp/TNewPopUp';
|
|
|
|
|
import * as Config from '../../../../utils/Config';
|
|
|
|
|
import {
|
|
|
|
|
$L,
|
|
|
|
|
removeSpecificTags,
|
|
|
|
|
} from '../../../../utils/helperMethods';
|
|
|
|
|
import css from './ProductDescription.module.less';
|
|
|
|
|
|
|
|
|
|
// TVerticalPagenator 제거됨 - TScrollerNew와 충돌 문제로 인해
|
|
|
|
|
|
|
|
|
|
const SpottableComponent = Spottable("div");
|
|
|
|
|
@@ -19,11 +42,22 @@ const Container = SpotlightContainerDecorator(
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
export default function ProductDescription({ productInfo }) {
|
|
|
|
|
const { popupVisible, activePopup } = useSelector(
|
|
|
|
|
(state) => state.common.popup
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const dispatch = useDispatch();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const productDescription = useCallback(() => {
|
|
|
|
|
const sanitizedString = removeSpecificTags(productInfo?.prdtDesc);
|
|
|
|
|
return { __html: sanitizedString };
|
|
|
|
|
}, [productInfo?.prdtDesc]);
|
|
|
|
|
|
|
|
|
|
const productDescriptionText = useMemo(() => {
|
|
|
|
|
return removeSpecificTags(productInfo?.prdtDesc);
|
|
|
|
|
}, [productInfo?.prdtDesc]);
|
|
|
|
|
|
|
|
|
|
// 왼쪽 화살표 키 이벤트 처리
|
|
|
|
|
const handleKeyDown = useCallback((ev) => {
|
|
|
|
|
if (ev.keyCode === 37) { // 왼쪽 화살표 키
|
|
|
|
|
@@ -34,6 +68,16 @@ export default function ProductDescription({ productInfo }) {
|
|
|
|
|
}
|
|
|
|
|
}, []);
|
|
|
|
|
|
|
|
|
|
const descriptionClick = useCallback(() => {
|
|
|
|
|
dispatch(setShowPopup(Config.ACTIVE_POPUP.scrollPopup));
|
|
|
|
|
},
|
|
|
|
|
[dispatch]
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const _onClose = useCallback(()=>{
|
|
|
|
|
dispatch(setHidePopup());
|
|
|
|
|
},[dispatch])
|
|
|
|
|
|
|
|
|
|
// ProductDescription: Container 직접 사용 패턴
|
|
|
|
|
// prdtDesc가 없으면 렌더링하지 않음
|
|
|
|
|
if (!productInfo?.prdtDesc) {
|
|
|
|
|
@@ -41,6 +85,7 @@ export default function ProductDescription({ productInfo }) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
|
|
|
|
<>
|
|
|
|
|
<Container
|
|
|
|
|
className={css.descriptionContainer}
|
|
|
|
|
spotlightId="product-description-container"
|
|
|
|
|
@@ -61,7 +106,8 @@ export default function ProductDescription({ productInfo }) {
|
|
|
|
|
<SpottableComponent
|
|
|
|
|
className={css.descriptionWrapper}
|
|
|
|
|
spotlightId="product-description-content"
|
|
|
|
|
onClick={() => console.log("[ProductDescription] Content clicked")}
|
|
|
|
|
// onClick={() => console.log("[ProductDescription] Content clicked")}
|
|
|
|
|
onClick={descriptionClick}
|
|
|
|
|
onFocus={() => console.log("[ProductDescription] Content focused")}
|
|
|
|
|
onBlur={() => console.log("[ProductDescription] Content blurred")}
|
|
|
|
|
onKeyDown={handleKeyDown}
|
|
|
|
|
@@ -72,5 +118,28 @@ export default function ProductDescription({ productInfo }) {
|
|
|
|
|
/>
|
|
|
|
|
</SpottableComponent>
|
|
|
|
|
</Container>
|
|
|
|
|
{activePopup === Config.ACTIVE_POPUP.scrollPopup && (
|
|
|
|
|
<TNewPopUp
|
|
|
|
|
kind="scrollPopup"
|
|
|
|
|
open={popupVisible}
|
|
|
|
|
hasText
|
|
|
|
|
title={$L("DESCRIPTION")}
|
|
|
|
|
onClick={_onClose}
|
|
|
|
|
hasButton
|
|
|
|
|
button1Text={$L("OK")}
|
|
|
|
|
>
|
|
|
|
|
<TButtonScroller
|
|
|
|
|
boxHeight={460}
|
|
|
|
|
width={844}
|
|
|
|
|
kind={"figmaTermsPopup"}
|
|
|
|
|
>
|
|
|
|
|
<div
|
|
|
|
|
className={css.scrollContainer}
|
|
|
|
|
dangerouslySetInnerHTML={{ __html: productDescriptionText }}
|
|
|
|
|
/>
|
|
|
|
|
</TButtonScroller>
|
|
|
|
|
</TNewPopUp>
|
|
|
|
|
)}
|
|
|
|
|
</>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|