[SHOPTIME-3983] Featured Brands / Category / 상품 확인 후 다시 CateCory 포커싱 시 첫번째 Category로 포커싱
[수정사항] 디테일 페이지에서 이전 버튼 눌렀을 때, 해당 Container가 last-focused를 유지하도록 preserveId 속성 추가
This commit is contained in:
@@ -1,26 +1,35 @@
|
||||
import React, { memo, useCallback, useEffect, useRef } from "react";
|
||||
import React, {
|
||||
memo,
|
||||
useCallback,
|
||||
useEffect,
|
||||
useRef,
|
||||
} from 'react';
|
||||
|
||||
import { useDispatch, useSelector } from "react-redux";
|
||||
import {
|
||||
useDispatch,
|
||||
useSelector,
|
||||
} from 'react-redux';
|
||||
|
||||
import { Job } from "@enact/core/util";
|
||||
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
||||
import { Job } from '@enact/core/util';
|
||||
import SpotlightContainerDecorator
|
||||
from '@enact/spotlight/SpotlightContainerDecorator';
|
||||
import {
|
||||
getContainerId,
|
||||
setContainerLastFocusedElement,
|
||||
} from "@enact/spotlight/src/container";
|
||||
} from '@enact/spotlight/src/container';
|
||||
|
||||
import { updatePanel } from "../../../../actions/panelActions";
|
||||
import TButton, { TYPES } from "../../../../components/TButton/TButton";
|
||||
import TScroller from "../../../../components/TScroller/TScroller";
|
||||
import useScrollReset from "../../../../hooks/useScrollReset";
|
||||
import useScrollTo from "../../../../hooks/useScrollTo";
|
||||
import { panel_names } from "../../../../utils/Config";
|
||||
import { $L } from "../../../../utils/helperMethods";
|
||||
import css from "./FeaturedCategoryNav.module.less";
|
||||
import { sendLogFeaturedBrands } from "../../../../actions/logActions";
|
||||
import { sendLogFeaturedBrands } from '../../../../actions/logActions';
|
||||
import { updatePanel } from '../../../../actions/panelActions';
|
||||
import TButton, { TYPES } from '../../../../components/TButton/TButton';
|
||||
import TScroller from '../../../../components/TScroller/TScroller';
|
||||
import useScrollReset from '../../../../hooks/useScrollReset';
|
||||
import useScrollTo from '../../../../hooks/useScrollTo';
|
||||
import { panel_names } from '../../../../utils/Config';
|
||||
import { $L } from '../../../../utils/helperMethods';
|
||||
import css from './FeaturedCategoryNav.module.less';
|
||||
|
||||
const Container = SpotlightContainerDecorator(
|
||||
{ leaveFor: { right: "" }, enterTo: "last-focused" },
|
||||
{ leaveFor: { right: "" }, enterTo: "last-focused", preserveId: true },
|
||||
"nav"
|
||||
);
|
||||
|
||||
@@ -86,22 +95,19 @@ export default memo(function FeaturedCategoryNav({
|
||||
useEffect(() => {
|
||||
if (fromGNB || fromQuickMenu) {
|
||||
logTimerRef.current = setTimeout(() => {
|
||||
dispatch(sendLogFeaturedBrands({
|
||||
catCd: "All",
|
||||
catNm: "All",
|
||||
patnrId: selectedPatnrId,
|
||||
patncNm: selectedPatncNm,
|
||||
}));
|
||||
dispatch(
|
||||
sendLogFeaturedBrands({
|
||||
catCd: "All",
|
||||
catNm: "All",
|
||||
patnrId: selectedPatnrId,
|
||||
patncNm: selectedPatncNm,
|
||||
})
|
||||
);
|
||||
}, 500);
|
||||
|
||||
return () => clearTimeout(logTimerRef.current);
|
||||
}
|
||||
}, [
|
||||
fromGNB,
|
||||
fromQuickMenu,
|
||||
selectedPatncNm,
|
||||
selectedPatnrId
|
||||
]);
|
||||
}, [fromGNB, fromQuickMenu, selectedPatncNm, selectedPatnrId]);
|
||||
|
||||
const handleBlur = useCallback(
|
||||
(itemIndex) => () => {
|
||||
@@ -136,12 +142,14 @@ export default memo(function FeaturedCategoryNav({
|
||||
);
|
||||
}
|
||||
|
||||
dispatch(sendLogFeaturedBrands({
|
||||
catCd: catCdLv1 || "All",
|
||||
catNm: catNmLv1 || "All",
|
||||
patnrId: selectedPatnrId ?? panelInfo?.patnrId,
|
||||
patncNm: selectedPatncNm,
|
||||
}));
|
||||
dispatch(
|
||||
sendLogFeaturedBrands({
|
||||
catCd: catCdLv1 || "All",
|
||||
catNm: catNmLv1 || "All",
|
||||
patnrId: selectedPatnrId ?? panelInfo?.patnrId,
|
||||
patncNm: selectedPatncNm,
|
||||
})
|
||||
);
|
||||
|
||||
setSelectedCatCdLv1(catCdLv1);
|
||||
setSelectedCatCdLv2(null);
|
||||
|
||||
Reference in New Issue
Block a user