[MainPanel] BestSeller, PopularShow 추가.

This commit is contained in:
junghoon86.park
2024-01-30 13:17:28 +09:00
parent 3e1f3b5ee3
commit dc2276ebb7
7 changed files with 143 additions and 43 deletions

View File

@@ -14,4 +14,7 @@
align-items: unset; align-items: unset;
flex-direction: unset; flex-direction: unset;
} }
&.homeBestSeller {
justify-content: unset;
}
} }

View File

@@ -0,0 +1,62 @@
import React, { useCallback, useEffect, useState, useRef } from "react";
import { useSelector } from "react-redux";
import TPanel from "../../../components/TPanel/TPanel";
import TButton from "../../../components/TButton/TButton";
import { $L } from "../../../utils/helperMethods";
import css from "./BestSeller.module.less";
import classNames from "classnames";
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
import Spotlight from "@enact/spotlight";
import Scroller from "@enact/sandstone/Scroller";
import { changeAppStatus } from "../../../features/common/commonSlice";
import { getSearch } from "../../../features/search/searchSlice";
import TGrid from "../../../components/TGrid/TGrid";
import TItemCard from "../../../components/TItemCard/TItemCard";
import SectionTitle from "../../../components/SectionTitle/SectionTitle";
const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused" },
"div",
"li"
);
const BestSeller = () => {
const bestSellerDatas = useSelector(
(state) => state.product.bestSellerData.bestSeller
);
return (
<Container className={css.noDataWrap}>
<div className={css.bestSellerWrap}>
<SectionTitle title={$L(`BEST SELLER`)} />
<Scroller
direction="horizontal"
horizontalScrollbar="hidden"
noScrollByWheel={true}
scrollMode="translate"
className={css.homeScroll}
>
<TGrid type="homeBestSeller">
{bestSellerDatas &&
bestSellerDatas.map((bestSeller) => (
<TItemCard
key={bestSeller.rankOrd}
imageSource={bestSeller.imgUrl}
imageAlt={bestSeller.prdtNm}
productName={bestSeller.prdtNm}
priceInfo={bestSeller.priceInfo}
rank={bestSeller.rankOrd}
isBestSeller
accType
/>
))}
</TGrid>
</Scroller>
</div>
</Container>
);
};
export default BestSeller;

View File

@@ -0,0 +1,12 @@
.bestSellerWrap {
padding: 70px 60px 78px;
> h2 {
margin: 0px 0 34px;
font-size: 42px;
}
> ul {
justify-content: unset;
align-items: unset;
flex-direction: unset;
}
}

View File

@@ -10,43 +10,49 @@ import css from "../HomePanel/HomePanel.module.less";
import HomeTemplate from "./HomeTemplate"; import HomeTemplate from "./HomeTemplate";
import OnSale from "../HomePanel/OnSale/OnSale"; import OnSale from "../HomePanel/OnSale/OnSale";
import SubCategory from "../HomePanel/SubCategory/SubCategory"; import SubCategory from "../HomePanel/SubCategory/SubCategory";
import PopularShow from "../HomePanel/PopularShow/PopularShow";
import BestSeller from "../HomePanel/BestSeller/BestSeller";
export default function HomePanel() { export default function HomePanel() {
const dispatch = useDispatch(); const dispatch = useDispatch();
const latoutData = useSelector((state) => state.home.layoutData); const latoutData = useSelector((state) => state.home.layoutData);
const homeMainContentsBannerInfos = useSelector((state) => state.home.mainContentsData.homeMainContentsBannerInfos); const homeMainContentsBannerInfos = useSelector(
const homeTopDisplayInfos = useSelector((state) => state.home.mainContentsData.homeTopDisplayInfos); (state) => state.home.mainContentsData.homeMainContentsBannerInfos
);
const homeTopDisplayInfos = useSelector(
(state) => state.home.mainContentsData.homeTopDisplayInfos
);
const [selectTemplate, setSelectTemplate] = useState(null); const [selectTemplate, setSelectTemplate] = useState(null);
const getHomeLayout = () => { const getHomeLayout = () => {
console.log("레이아웃"); console.log("레이아웃");
} };
const getHomeContents = () => { const getHomeContents = () => {
// 추후 다시 한번 확인: 코드(DSP00201, 202, 203) // 추후 다시 한번 확인: 코드(DSP00201, 202, 203)
// 템플릿 선택 // 템플릿 선택
let tempTemplate = 0; let tempTemplate = 0;
if(homeMainContentsBannerInfos){ if (homeMainContentsBannerInfos) {
if(homeMainContentsBannerInfos[0].shptmTmplCd == "DSP00201"){ if (homeMainContentsBannerInfos[0].shptmTmplCd == "DSP00201") {
tempTemplate = 1; tempTemplate = 1;
} }
if(homeMainContentsBannerInfos[0].shptmTmplCd == "DSP00202"){ if (homeMainContentsBannerInfos[0].shptmTmplCd == "DSP00202") {
tempTemplate = 2; tempTemplate = 2;
} }
if(homeMainContentsBannerInfos[0].shptmTmplCd == "DSP00203"){ if (homeMainContentsBannerInfos[0].shptmTmplCd == "DSP00203") {
tempTemplate = 3; tempTemplate = 3;
} }
} }
setSelectTemplate(tempTemplate); setSelectTemplate(tempTemplate);
} };
useEffect(()=>{ useEffect(() => {
getHomeLayout(); getHomeLayout();
getHomeContents(); getHomeContents();
},[]) }, []);
return ( return (
<TPanel className={css.panelDesign}> <TPanel className={css.panelDesign}>
<HomeTemplate <HomeTemplate
@@ -56,7 +62,8 @@ export default function HomePanel() {
/> />
<SubCategory /> <SubCategory />
<OnSale /> <OnSale />
<PopularShow />
<BestSeller />
</TPanel> </TPanel>
); );
} }

View File

@@ -11,6 +11,7 @@
color: #1a1a1a; color: #1a1a1a;
font-weight: bold; font-weight: bold;
font-family: "LGSmartUIBold"; font-family: "LGSmartUIBold";
font-size: 42px;
} }
.onSaleItem { .onSaleItem {
margin-top: 20px; margin-top: 20px;

View File

@@ -4,16 +4,16 @@ import { $L } from "../../../utils/helperMethods";
import { Job } from "@enact/core/util"; import { Job } from "@enact/core/util";
import Spotlight from "@enact/spotlight"; import Spotlight from "@enact/spotlight";
import Spottable from "@enact/spotlight/Spottable"; import Spottable from "@enact/spotlight/Spottable";
import Scroller from "@enact/sandstone/Scroller";
import { getTop20Show } from "../../../features/main/mainSlice"; import { getTop20Show } from "../../../features/main/mainSlice";
import classNames from "classnames";
import css from "../PopularShow/PopularShow.module.less"; import css from "../PopularShow/PopularShow.module.less";
const SpottableComponent = Spottable("div"); const SpottableComponent = Spottable("li");
const PopularShow = (...rest) => { const PopularShow = (...rest) => {
const dispatch = useDispatch(); const dispatch = useDispatch();
const TopInfos = useSelector((state) => state.main.top20ShowData.topInfos); const topInfos = useSelector((state) => state.main.top20ShowData.topInfos);
useEffect(() => { useEffect(() => {
dispatch(getTop20Show()); dispatch(getTop20Show());
@@ -22,28 +22,32 @@ const PopularShow = (...rest) => {
<div {...rest} className={css.container}> <div {...rest} className={css.container}>
<div className={css.popularShow}> <div className={css.popularShow}>
<h2 className={css.subTitle}>{$L("POPULAR SHOW")}</h2> <h2 className={css.subTitle}>{$L("POPULAR SHOW")}</h2>
<ul className={css.showList}> <ul className={css.showList}>
<li className={css.listItem}> {topInfos &&
<img src="https://picsum.photos/510/288" className={css.itemImg} /> topInfos.map((item) => {
<div className={css.horizonItem}> return (
Product Name Product Name Product Name Product Name Product Name <li
Product Name Product Name Product Name key={item.listItem}
</div> className={classNames(
</li> item.thumbnailUrl960 == item.thumbnailUrl
{/* 세로형 ? css.listItemVertical
<li className={css.listItemVertical}> : css.listItem
<img src="https://picsum.photos/228/402" className={css.itemImg} /> )}
<div className={css.verticalItem}> >
Product Name Product Name Product Name Product Name Product Name <img src={item.thumbnailUrl960} className={css.itemImg} />
Product Name Product Name Product Name Product Name Product Name <div
Product Name Product Name Product Name Product Name Product Name className={classNames(
Product Name Product Name Product Name Product Name Product Name item.thumbnailUrl960 == item.thumbnailUrl
Product Name Product Name Product Name Product Name Product Name ? css.verticalItem
Product Name Product Name Product Name Product Name Product Name : css.horizonItem
Product Name Product Name )}
</div> >
</li> {item.showNm}
*/} </div>
</li>
);
})}
</ul> </ul>
</div> </div>
</div> </div>

View File

@@ -1,6 +1,6 @@
@import "../../../style/CommonStyle.module.less"; @import "../../../style/CommonStyle.module.less";
.popularShow { .popularShow {
padding: 60px 0; padding: 60px 0 0;
width: 100%; width: 100%;
overflow-x: auto; overflow-x: auto;
margin-left: 60px; margin-left: 60px;
@@ -11,11 +11,12 @@
color: #1a1a1a; color: #1a1a1a;
font-weight: bold; font-weight: bold;
font-family: "LGSmartUIBold"; font-family: "LGSmartUIBold";
font-size: 42px;
} }
.showList { .showList {
margin-top: 20px; margin-top: 20px;
display: flex; display: flex;
overflow: hidden; overflow: auto;
> li:nth-child(1n) { > li:nth-child(1n) {
margin-right: 18px; margin-right: 18px;
border: 4px solid transparent; border: 4px solid transparent;
@@ -37,6 +38,11 @@
border-radius: 12px; border-radius: 12px;
border: solid 1px @COLOR_GRAY02; border: solid 1px @COLOR_GRAY02;
box-sizing: border-box; box-sizing: border-box;
> img {
width: 510px;
height: 288px;
object-fit: contain;
}
.horizonItem { .horizonItem {
width: 510px; width: 510px;
height: 60px; height: 60px;
@@ -59,6 +65,11 @@
border-radius: 12px; border-radius: 12px;
border: solid 1px @COLOR_GRAY02; border: solid 1px @COLOR_GRAY02;
box-sizing: border-box; box-sizing: border-box;
> img {
width: 228px;
height: 402px;
object-fit: contain;
}
.verticalItem { .verticalItem {
margin-left: 11px; margin-left: 11px;
color: #333; color: #333;