[onSalePanel] useScrollTo hook 적용 및 SpotlightContainerDecorator 수정
Detail Notes : 1. OnSalePanel.jsx, useScrollTo 적용 2. CategoryNav.jsx, scrollTop props 추가 3. CategoryNav.jsx, OnSaleProductList.jsx, SpotlightContainerDecorator enterTo 삭제
This commit is contained in:
@@ -14,13 +14,14 @@ const LIST_ITEM_CONF = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Container = SpotlightContainerDecorator(
|
const Container = SpotlightContainerDecorator(
|
||||||
{ leaveFor: { right: "" }, enterTo: "last-focused" },
|
{ leaveFor: { right: "" } },
|
||||||
"nav"
|
"nav"
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function CategoryNav({
|
export default function CategoryNav({
|
||||||
categoryInfos,
|
categoryInfos,
|
||||||
currentCategoryCode,
|
currentCategoryCode,
|
||||||
|
scrollTop,
|
||||||
setCurrentCategoryCode,
|
setCurrentCategoryCode,
|
||||||
...rest
|
...rest
|
||||||
}) {
|
}) {
|
||||||
@@ -31,6 +32,7 @@ export default function CategoryNav({
|
|||||||
}
|
}
|
||||||
|
|
||||||
setCurrentCategoryCode(categoryCode);
|
setCurrentCategoryCode(categoryCode);
|
||||||
|
scrollTop();
|
||||||
},
|
},
|
||||||
[currentCategoryCode]
|
[currentCategoryCode]
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -6,12 +6,15 @@ import { getOnSaleInfo } from "../../actions/onSaleActions";
|
|||||||
import TBody from "../../components/TBody/TBody";
|
import TBody from "../../components/TBody/TBody";
|
||||||
import TopButton from "../../components/TopButton/TopButton";
|
import TopButton from "../../components/TopButton/TopButton";
|
||||||
import TPanel from "../../components/TPanel/TPanel";
|
import TPanel from "../../components/TPanel/TPanel";
|
||||||
|
import useScrollTo from "../../hooks/useScrollTo";
|
||||||
import { SpotlightIds } from "../../utils/SpotlightIds";
|
import { SpotlightIds } from "../../utils/SpotlightIds";
|
||||||
import CategoryNav from "../OnSalePanel/CategoryNav/CategoryNav";
|
import CategoryNav from "../OnSalePanel/CategoryNav/CategoryNav";
|
||||||
import css from "./OnSalePanel.module.less";
|
import css from "./OnSalePanel.module.less";
|
||||||
import OnSaleProductList from "./OnSaleProductList/OnSaleProductList";
|
import OnSaleProductList from "./OnSaleProductList/OnSaleProductList";
|
||||||
|
|
||||||
export default function OnSalePanel() {
|
export default function OnSalePanel() {
|
||||||
|
const { getScrollTo, scrollTop } = useScrollTo();
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const categoryInfos = useSelector(
|
const categoryInfos = useSelector(
|
||||||
@@ -40,7 +43,7 @@ export default function OnSalePanel() {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (saleInfos) {
|
if (saleInfos) {
|
||||||
const id = saleInfos[0].saleProductInfos[0].prdtId;
|
const id = saleInfos[0].saleProductInfos[0].prdtId;
|
||||||
setTargetId(id);
|
setTargetId(SpotlightIds.TITEM_CARD + id);
|
||||||
}
|
}
|
||||||
}, [dispatch, saleInfos]);
|
}, [dispatch, saleInfos]);
|
||||||
|
|
||||||
@@ -50,8 +53,9 @@ export default function OnSalePanel() {
|
|||||||
categoryInfos={categoryInfos}
|
categoryInfos={categoryInfos}
|
||||||
currentCategoryCode={currentCategoryCode}
|
currentCategoryCode={currentCategoryCode}
|
||||||
setCurrentCategoryCode={setCurrentCategoryCode}
|
setCurrentCategoryCode={setCurrentCategoryCode}
|
||||||
|
scrollTop={scrollTop}
|
||||||
/>
|
/>
|
||||||
<TBody className={css.tBody}>
|
<TBody className={css.tBody} cbScrollTo={getScrollTo}>
|
||||||
{saleInfos &&
|
{saleInfos &&
|
||||||
saleInfos.map(({ saleNm, saleProductInfos }) => (
|
saleInfos.map(({ saleNm, saleProductInfos }) => (
|
||||||
<OnSaleProductList
|
<OnSaleProductList
|
||||||
@@ -60,7 +64,7 @@ export default function OnSalePanel() {
|
|||||||
saleProductInfos={saleProductInfos}
|
saleProductInfos={saleProductInfos}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<TopButton targetId={SpotlightIds.TITEM_CARD + targetId} />
|
<TopButton targetId={targetId} />
|
||||||
</TBody>
|
</TBody>
|
||||||
</TPanel>
|
</TPanel>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -15,7 +15,7 @@ const LIST_ITEM_CONF = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const Container = SpotlightContainerDecorator(
|
const Container = SpotlightContainerDecorator(
|
||||||
{ leaveFor: { right: "" }, enterTo: "last-focused" },
|
{ leaveFor: { right: "" } },
|
||||||
"div"
|
"div"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user