[상품상세] description 클릭시 팝업 노출 처리

- 너무 긴경우 포커스가 넘어가는문제가 있어 클릭시에는 팝업이 노출되어 전체 영역을 확인할수있도록 수정.
This commit is contained in:
junghoon86.park
2025-12-16 13:55:51 +09:00
parent e4a64644dd
commit 83905a092d
4 changed files with 114 additions and 39 deletions

View File

@@ -483,7 +483,7 @@
.default-style();
.scrollInfo {
width: 900px;
width: 850px;
background-color: @BG_COLOR_01;
color: @COLOR_GRAY03;
display: flex;

View File

@@ -114,6 +114,7 @@ export const ACTIVE_POPUP = {
optionalConfirm: 'optionalConfirm',
energyPopup: 'energyPopup',
addCartPopup: 'addCartPopup',
scrollPopup: 'scrollPopup',
};
export const DEBUG_VIDEO_SUBTITLE_TEST = false;
export const AUTO_SCROLL_DELAY = 600;

View File

@@ -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>
)}
</>
);
}

View File

@@ -51,3 +51,8 @@
}
}
.scrollContainer {
padding: 31px;
font-size: 26px;
line-height: 1.5;
}