[251209] feat: NBCU-ShopByShow-5
🕐 커밋 시간: 2025. 12. 09. 16:28:02 📊 변경 통계: • 총 파일: 2개 • 추가: +32줄 • 삭제: -2줄 📝 수정된 파일: ~ com.twin.app.shoptime/src/views/FeaturedBrandsPanel/ShopByShow/ShopByShow.jsx ~ com.twin.app.shoptime/src/views/FeaturedBrandsPanel/ShopByShow/ShopByShowList/ShopByShowNav/ShopByShowNav.jsx 🔧 주요 변경 내용: • 소규모 기능 개선
This commit is contained in:
@@ -35,6 +35,7 @@ const ShopByShow = ({
|
|||||||
shelfTitle,
|
shelfTitle,
|
||||||
}) => {
|
}) => {
|
||||||
const [firstChk, setFirstChk] = useState(0);
|
const [firstChk, setFirstChk] = useState(0);
|
||||||
|
const [selectedContsId, setSelectedContsId] = useState(null);
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const { getScrollTo, scrollLeft } = useScrollTo({ skipAutoScrollTop: true });
|
const { getScrollTo, scrollLeft } = useScrollTo({ skipAutoScrollTop: true });
|
||||||
const panelInfo = useSelector((state) => state.panels.panels[0]?.panelInfo);
|
const panelInfo = useSelector((state) => state.panels.panels[0]?.panelInfo);
|
||||||
@@ -43,8 +44,15 @@ const ShopByShow = ({
|
|||||||
const brandShopByShowClctInfos = brandShopByShowContsInfo?.brandShopByShowClctInfos || [];
|
const brandShopByShowClctInfos = brandShopByShowContsInfo?.brandShopByShowClctInfos || [];
|
||||||
|
|
||||||
const handleContsIdChange = useCallback((contsId) => {
|
const handleContsIdChange = useCallback((contsId) => {
|
||||||
dispatch(getBrandShopByShow({ patnrId: selectedPatnrId, contsId }));
|
setSelectedContsId(contsId);
|
||||||
}, [selectedPatnrId, dispatch]);
|
|
||||||
|
// 'ALL' 버튼 클릭 시 (contsId === null) 첫 번째 contents 로드
|
||||||
|
const targetContsId = contsId || (brandShopByShowContsList?.[0]?.contsId);
|
||||||
|
|
||||||
|
if (targetContsId) {
|
||||||
|
dispatch(getBrandShopByShow({ patnrId: selectedPatnrId, contsId: targetContsId }));
|
||||||
|
}
|
||||||
|
}, [selectedPatnrId, brandShopByShowContsList, dispatch]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (panelInfo?.section !== "shop-by-show" || !panelInfo?.x) {
|
if (panelInfo?.section !== "shop-by-show" || !panelInfo?.x) {
|
||||||
@@ -109,6 +117,7 @@ const ShopByShow = ({
|
|||||||
brandShopByShowContsInfo={brandShopByShowContsInfo}
|
brandShopByShowContsInfo={brandShopByShowContsInfo}
|
||||||
handleItemFocus={_handleItemFocus}
|
handleItemFocus={_handleItemFocus}
|
||||||
onContsIdChange={handleContsIdChange}
|
onContsIdChange={handleContsIdChange}
|
||||||
|
selectedContsId={selectedContsId}
|
||||||
/>
|
/>
|
||||||
{brandShopByShowClctInfos.map((collection, collIdx) => (
|
{brandShopByShowClctInfos.map((collection, collIdx) => (
|
||||||
<ShopByShowContents
|
<ShopByShowContents
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDeco
|
|||||||
import TButton, { TYPES } from "../../../../../components/TButton/TButton";
|
import TButton, { TYPES } from "../../../../../components/TButton/TButton";
|
||||||
import TScroller from "../../../../../components/TScroller/TScroller";
|
import TScroller from "../../../../../components/TScroller/TScroller";
|
||||||
import useScrollTo from "../../../../../hooks/useScrollTo";
|
import useScrollTo from "../../../../../hooks/useScrollTo";
|
||||||
|
import { $L } from "../../../../../utils/helperMethods";
|
||||||
import css from "./ShopByShowNav.module.less";
|
import css from "./ShopByShowNav.module.less";
|
||||||
|
|
||||||
const Container = SpotlightContainerDecorator(
|
const Container = SpotlightContainerDecorator(
|
||||||
@@ -12,12 +13,16 @@ const Container = SpotlightContainerDecorator(
|
|||||||
"nav"
|
"nav"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const STRING_CONF = {
|
||||||
|
ALL: "ALL",
|
||||||
|
};
|
||||||
|
|
||||||
export default memo(function ShopByShowNav({
|
export default memo(function ShopByShowNav({
|
||||||
brandShopByShowContsList,
|
brandShopByShowContsList,
|
||||||
brandShopByShowContsInfo,
|
brandShopByShowContsInfo,
|
||||||
handleItemFocus,
|
handleItemFocus,
|
||||||
onContsIdChange,
|
onContsIdChange,
|
||||||
|
selectedContsId,
|
||||||
}) {
|
}) {
|
||||||
const { getScrollTo, scrollLeft } = useScrollTo();
|
const { getScrollTo, scrollLeft } = useScrollTo();
|
||||||
|
|
||||||
@@ -34,10 +39,26 @@ export default memo(function ShopByShowNav({
|
|||||||
}
|
}
|
||||||
}, [handleItemFocus]);
|
}, [handleItemFocus]);
|
||||||
|
|
||||||
|
const selectedText = !selectedContsId ? "Selected " : "";
|
||||||
|
const allLabeltext = selectedText + "ALL 1 of " + (brandShopByShowContsList.length + 1);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className={css.nav} id="shop-by-show-nav-id" spotlightId="shop-by-show-nav-id">
|
<Container className={css.nav} id="shop-by-show-nav-id" spotlightId="shop-by-show-nav-id">
|
||||||
<TScroller cbScrollTo={getScrollTo} direction="horizontal" noScrollByWheel>
|
<TScroller cbScrollTo={getScrollTo} direction="horizontal" noScrollByWheel>
|
||||||
<ul>
|
<ul>
|
||||||
|
{/* 'ALL' 버튼 - 디자인에 없어서 주석 처리 */}
|
||||||
|
{/* <li>
|
||||||
|
<TButton
|
||||||
|
className={!selectedContsId && css.selected}
|
||||||
|
onClick={handleClick(null)}
|
||||||
|
onFocus={handleFocus}
|
||||||
|
selected={!selectedContsId}
|
||||||
|
type={TYPES.oneDepthCategory}
|
||||||
|
ariaLabel={allLabeltext}
|
||||||
|
>
|
||||||
|
{$L(STRING_CONF.ALL)}
|
||||||
|
</TButton>
|
||||||
|
</li> */}
|
||||||
{brandShopByShowContsList &&
|
{brandShopByShowContsList &&
|
||||||
brandShopByShowContsList.map(({ contsId, contsNm }, index) => (
|
brandShopByShowContsList.map(({ contsId, contsNm }, index) => (
|
||||||
<li key={"shop-by-show-conts-" + index}>
|
<li key={"shop-by-show-conts-" + index}>
|
||||||
|
|||||||
Reference in New Issue
Block a user