[OnSalePanel] TopButton 반영
Detail Notes : 1. TopButton component 반영
This commit is contained in:
@@ -1,14 +1,23 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, {
|
||||||
|
useEffect,
|
||||||
|
useState,
|
||||||
|
} from 'react';
|
||||||
|
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import {
|
||||||
|
useDispatch,
|
||||||
|
useSelector,
|
||||||
|
} from 'react-redux';
|
||||||
|
|
||||||
import { getOnSaleInfo } from "../../actions/onSaleActions";
|
import { getOnSaleInfo } from '../../actions/onSaleActions';
|
||||||
import TBody from "../../components/TBody/TBody";
|
import TBody from '../../components/TBody/TBody';
|
||||||
import TItemCard from "../../components/TItemCard/TItemCard";
|
import TItemCard from '../../components/TItemCard/TItemCard';
|
||||||
import TPanel from "../../components/TPanel/TPanel";
|
import TopButton from '../../components/TopButton/TopButton';
|
||||||
import CategoryNav from "../OnSalePanel/CategoryNav/CategoryNav";
|
import TPanel from '../../components/TPanel/TPanel';
|
||||||
import OnSaleProductsGrid from "../OnSalePanel/OnSaleProductsGrid/OnSaleProductsGrid";
|
import { SpotlightIds } from '../../utils/SpotlightIds';
|
||||||
import css from "./OnSalePanel.module.less";
|
import CategoryNav from '../OnSalePanel/CategoryNav/CategoryNav';
|
||||||
|
import OnSaleProductsGrid
|
||||||
|
from '../OnSalePanel/OnSaleProductsGrid/OnSaleProductsGrid';
|
||||||
|
import css from './OnSalePanel.module.less';
|
||||||
|
|
||||||
export default function OnSalePanel() {
|
export default function OnSalePanel() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
@@ -20,7 +29,9 @@ export default function OnSalePanel() {
|
|||||||
|
|
||||||
const [currentLgCatCd, setCurrentLgCatCd] = useState();
|
const [currentLgCatCd, setCurrentLgCatCd] = useState();
|
||||||
|
|
||||||
const handleCategoryNav = (lgCatCd) => {
|
const targetId = saleInfos[0].saleProductInfos[0].prdtId;
|
||||||
|
|
||||||
|
const handleCategoryNavClick = (lgCatCd) => {
|
||||||
if (currentLgCatCd === lgCatCd) {
|
if (currentLgCatCd === lgCatCd) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -48,28 +59,32 @@ export default function OnSalePanel() {
|
|||||||
<CategoryNav
|
<CategoryNav
|
||||||
categoryInfos={categoryInfos}
|
categoryInfos={categoryInfos}
|
||||||
currentLgCatCd={currentLgCatCd}
|
currentLgCatCd={currentLgCatCd}
|
||||||
onCategoryNavClick={handleCategoryNav}
|
onCategoryNavClick={handleCategoryNavClick}
|
||||||
/>
|
/>
|
||||||
<TBody className={css.tBody}>
|
<TBody className={css.tBody}>
|
||||||
{saleInfos &&
|
{saleInfos &&
|
||||||
saleInfos.map(({ saleNm, saleProductInfos }) => {
|
saleInfos.map(({ saleNm, saleProductInfos }) => {
|
||||||
return (
|
return (
|
||||||
<OnSaleProductsGrid key={saleNm} sectionTitle={saleNm}>
|
<OnSaleProductsGrid key={saleNm} sectionTitle={saleNm}>
|
||||||
{saleProductInfos.map((saleProduct) => {
|
{saleProductInfos.map(
|
||||||
return (
|
({ imgUrl, prdtId, prdtNm, priceInfo }) => {
|
||||||
<TItemCard
|
return (
|
||||||
key={saleProduct.prdtId}
|
<TItemCard
|
||||||
imageAlt={saleProduct.prdtNm}
|
key={prdtId}
|
||||||
imageSource={saleProduct.imgUrl}
|
imageAlt={prdtNm}
|
||||||
priceInfo={saleProduct.priceInfo}
|
imageSource={imgUrl}
|
||||||
productId={saleProduct.prdtId}
|
priceInfo={priceInfo}
|
||||||
productName={saleProduct.prdtNm}
|
productId={prdtId}
|
||||||
/>
|
productName={prdtNm}
|
||||||
);
|
/>
|
||||||
})}
|
);
|
||||||
|
}
|
||||||
|
)}
|
||||||
</OnSaleProductsGrid>
|
</OnSaleProductsGrid>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
||||||
|
<TopButton targetId={SpotlightIds.TITEM_CARD + targetId} />
|
||||||
</TBody>
|
</TBody>
|
||||||
</TPanel>
|
</TPanel>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user