[HomePanel] API 적용 완료
This commit is contained in:
@@ -1,6 +1,4 @@
|
|||||||
import React, {useCallback, useEffect, useState, useMemo,useRef ,memo} from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
import classNames from "classnames";
|
|
||||||
|
|
||||||
import { Job } from "@enact/core/util";
|
import { Job } from "@enact/core/util";
|
||||||
import { SpotlightContainerDecorator } from "@enact/spotlight/SpotlightContainerDecorator";
|
import { SpotlightContainerDecorator } from "@enact/spotlight/SpotlightContainerDecorator";
|
||||||
@@ -10,10 +8,8 @@ import Marquee from "@enact/sandstone/Marquee";
|
|||||||
import Spottable from "@enact/spotlight/Spottable";
|
import Spottable from "@enact/spotlight/Spottable";
|
||||||
import CustomImage from "../../../components/CustomImage/CustomImage";
|
import CustomImage from "../../../components/CustomImage/CustomImage";
|
||||||
import css from "./Template.module.less";
|
import css from "./Template.module.less";
|
||||||
|
import Random from "./RandomUnit";
|
||||||
import banner2 from "../../../../assets/Image/img-home-banner-h-02.png";
|
import Rolling from "./RollingUnit";
|
||||||
import banner3 from "../../../../assets/Image/img-home-banner-v-01.png";
|
|
||||||
import banner4 from "../../../../assets/Image/img-home-banner-v-02.png";
|
|
||||||
|
|
||||||
const SpottableComponent = Spottable("div");
|
const SpottableComponent = Spottable("div");
|
||||||
|
|
||||||
@@ -24,92 +20,153 @@ const Container = SpotlightContainerDecorator(
|
|||||||
"div"
|
"div"
|
||||||
);
|
);
|
||||||
|
|
||||||
export default memo (function HomeBannerTemplate1 ({isOnTop, spotlightId, onScrollTop, onScrollShelf, ...rest}) {
|
export default function HomeBannerTemplate1 ({ isOnTop, spotlightId, onScrollTop, onScrollShelf, homeMainContentsBannerInfos, homeTopDisplayInfos, ...rest }) {
|
||||||
|
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
const homeMainContentsBannerInfos = useSelector((state) => state.home.mainContentsData.homeMainContentsBannerInfos);
|
|
||||||
const homeTopDisplayInfos = useSelector((state) => state.home.mainContentsData.homeTopDisplayInfos[0]);
|
|
||||||
|
|
||||||
const [topImagePath, setTopImagePath] = useState("");
|
|
||||||
const [verticalImage, setVerticalImage] = useState("");
|
|
||||||
const [bannerImageLoaded, setBannerImageLoaded] = useState(false);
|
const [bannerImageLoaded, setBannerImageLoaded] = useState(false);
|
||||||
|
|
||||||
// TOP IMAGE
|
const [baner1Index, setBaner1Index] = useState("");
|
||||||
const topImgPath = () => {
|
const [baner2Index, setBaner2Index] = useState("");
|
||||||
|
const [baner3Index, setBaner3Index] = useState("");
|
||||||
|
const [baner4Index, setBaner4Index] = useState("");
|
||||||
|
|
||||||
|
const [baner1Data, setBaner1Data] = useState([]);
|
||||||
|
const [baner2Data, setBaner2Data] = useState([]);
|
||||||
|
const [baner3Data, setBaner3Data] = useState([]);
|
||||||
|
const [baner4Data, setBaner4Data] = useState([]);
|
||||||
|
|
||||||
|
const bannerInfos = homeMainContentsBannerInfos[0].bannerInfos;
|
||||||
|
|
||||||
|
// 배너가 없는 경우, 대체용 배너 [수직]
|
||||||
|
const replaceBannerVtctp = useCallback(() => {
|
||||||
let imgPath = "";
|
let imgPath = "";
|
||||||
|
|
||||||
if(homeTopDisplayInfos.wdthtpImgPath1 == "" || homeTopDisplayInfos.wdthtpImgPath1 == null){
|
if(homeTopDisplayInfos[0].vtctpImgPath1 == "" || homeTopDisplayInfos[0].vtctpImgPath1 == null){
|
||||||
imgPath = homeTopDisplayInfos.wdthtpImgPath2;
|
imgPath = homeTopDisplayInfos[0].vtctpImgPath2;
|
||||||
}else{
|
}else{
|
||||||
imgPath = homeTopDisplayInfos.wdthtpImgPath1;
|
imgPath = homeTopDisplayInfos[0].vtctpImgPath1;
|
||||||
}
|
}
|
||||||
|
return imgPath;
|
||||||
|
},[]);
|
||||||
|
|
||||||
setTopImagePath(imgPath);
|
// 배너가 없는 경우, 대체용 배너 [수평]
|
||||||
};
|
const replaceBannerWdth = useCallback(() => {
|
||||||
|
|
||||||
// VerticalImage
|
|
||||||
const vtctpImage = () => {
|
|
||||||
let imgPath = "";
|
let imgPath = "";
|
||||||
|
|
||||||
if(homeTopDisplayInfos.vtctpImgPath1 == "" || homeTopDisplayInfos.vtctpImgPath1 == null){
|
if(homeTopDisplayInfos[0].wdthtpImgPath1 == "" || homeTopDisplayInfos[0].wdthtpImgPath1 == null){
|
||||||
imgPath = homeTopDisplayInfos.vtctpImgPath2;
|
imgPath = homeTopDisplayInfos[0].wdthtpImgPath2;
|
||||||
}else{
|
}else{
|
||||||
imgPath = homeTopDisplayInfos.vtctpImgPath1;
|
imgPath = homeTopDisplayInfos[0].wdthtpImgPath1;
|
||||||
}
|
}
|
||||||
|
return imgPath;
|
||||||
setVerticalImage(imgPath);
|
},[]);
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
topImgPath();
|
|
||||||
vtctpImage();
|
|
||||||
|
|
||||||
}, [homeMainContentsBannerInfos, homeTopDisplayInfos]);
|
|
||||||
|
|
||||||
const onClickBanner = useCallback(() => {
|
const onClickBanner = useCallback(() => {
|
||||||
|
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
bannerInfos.forEach((el, index) => {
|
||||||
|
if(el.banrLctnNo == "1"){
|
||||||
|
setBaner1Data(el);
|
||||||
|
setBaner1Index(index);
|
||||||
|
}
|
||||||
|
else if(el.banrLctnNo == "2"){
|
||||||
|
setBaner2Data(el);
|
||||||
|
setBaner2Index(index);
|
||||||
|
}
|
||||||
|
else if(el.banrLctnNo == "3"){
|
||||||
|
setBaner3Data(el);
|
||||||
|
setBaner3Index(index);
|
||||||
|
}
|
||||||
|
else if(el.banrLctnNo == "4"){
|
||||||
|
setBaner4Data(el);
|
||||||
|
setBaner4Index(index);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
console.log(homeMainContentsBannerInfos, "메인 컨텐츠");
|
||||||
|
console.log(homeTopDisplayInfos, "탑디스");
|
||||||
|
}, [homeMainContentsBannerInfos]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Container className={(css.container, css.homeTemplateBox)}>
|
<Container className={(css.container, css.homeTemplateBox)}>
|
||||||
<div className={css.leftBannerBox}>
|
<SpottableComponent>
|
||||||
<CustomImage
|
<div className={css.leftBannerBox}>
|
||||||
className={css.banner02}
|
{/* 배너1 */}
|
||||||
delay={0}
|
{baner1Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
onClickBanner={onClickBanner}
|
<Rolling
|
||||||
onImageLoaded={setBannerImageLoaded}
|
banerData={baner2Data}
|
||||||
src={topImagePath}
|
/>
|
||||||
hide={""}
|
) : baner1Data.shptmDspyTpNm == "Random" ? (
|
||||||
/>
|
<Random
|
||||||
|
banerData={baner3Data}
|
||||||
<CustomImage
|
/>
|
||||||
className={css.banner02}
|
) :
|
||||||
delay={0}
|
<CustomImage
|
||||||
onClickBanner={onClickBanner}
|
className={""}
|
||||||
onImageLoaded={setBannerImageLoaded}
|
delay={0}
|
||||||
src={topImagePath}
|
onClickBanner={onClickBanner}
|
||||||
hide={""}
|
onImageLoaded={""}
|
||||||
/>
|
src={replaceBannerWdth}
|
||||||
</div>
|
hide={""}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
{/* 배너2 롤링 테스트 진행중 */}
|
||||||
|
{baner2Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
|
<Random
|
||||||
|
banerData={baner2Data}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
</div>
|
||||||
|
</SpottableComponent>
|
||||||
|
|
||||||
<div className={css.bannerFlexRow}>
|
<div className={css.bannerFlexRow}>
|
||||||
<CustomImage
|
{/* 배너3 */}
|
||||||
className={css.banner03}
|
{baner3Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
delay={0}
|
<Rolling
|
||||||
onClickBanner={onClickBanner}
|
banerData={baner3Data}
|
||||||
onImageLoaded={setBannerImageLoaded}
|
/>
|
||||||
src={verticalImage}
|
) : baner3Data.shptmDspyTpNm == "Random" ? (
|
||||||
hide={""}
|
<Random
|
||||||
/>
|
banerData={baner3Data}
|
||||||
<CustomImage
|
/>
|
||||||
className={css.banner04}
|
) :
|
||||||
delay={0}
|
<SpottableComponent>
|
||||||
onClickBanner={onClickBanner}
|
<CustomImage
|
||||||
onImageLoaded={setBannerImageLoaded}
|
className={css.banner03}
|
||||||
src={verticalImage}
|
delay={0}
|
||||||
hide={""}
|
onClickBanner={onClickBanner}
|
||||||
/>
|
onImageLoaded={""}
|
||||||
|
src={replaceBannerVtctp}
|
||||||
|
hide={""}
|
||||||
|
/>
|
||||||
|
</SpottableComponent>
|
||||||
|
}
|
||||||
|
|
||||||
|
{/* 배너4 */}
|
||||||
|
{baner4Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
|
<SpottableComponent>
|
||||||
|
<Rolling
|
||||||
|
banerData={baner4Data}
|
||||||
|
/>
|
||||||
|
</SpottableComponent>
|
||||||
|
) : baner4Data.shptmDspyTpNm == "Random" ? (
|
||||||
|
<Random
|
||||||
|
banerData={baner4Data}
|
||||||
|
/>
|
||||||
|
) :
|
||||||
|
<SpottableComponent>
|
||||||
|
<CustomImage
|
||||||
|
className={css.banner03}
|
||||||
|
delay={0}
|
||||||
|
onClickBanner={onClickBanner}
|
||||||
|
onImageLoaded={""}
|
||||||
|
src={replaceBannerVtctp}
|
||||||
|
hide={""}
|
||||||
|
/>
|
||||||
|
</SpottableComponent>
|
||||||
|
}
|
||||||
</div>
|
</div>
|
||||||
</Container>
|
</Container>
|
||||||
);
|
);
|
||||||
})
|
}
|
||||||
@@ -1,8 +1,12 @@
|
|||||||
export default function HomeBannerTemplate2 () {
|
import React, {useCallback, useEffect, useState, useMemo,useRef ,memo} from "react";
|
||||||
|
|
||||||
|
export default function HomeBannerTemplate2 ({isOnTop, spotlightId, onScrollTop, onScrollShelf, homeMainContentsBannerInfos, homeTopDisplayInfos, ...rest}) {
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
|
||||||
|
}, [])
|
||||||
|
|
||||||
return(
|
return(
|
||||||
<p>템플릿2</p>
|
<p>템플릿2</p>
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,16 +1,21 @@
|
|||||||
import React, { useEffect } from "react";
|
import React, { useCallback, useEffect, useState } from "react";
|
||||||
|
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { Job } from "@enact/core/util";
|
||||||
|
import { SpotlightContainerDecorator } from "@enact/spotlight/SpotlightContainerDecorator";
|
||||||
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
|
|
||||||
import Spottable from "@enact/spotlight/Spottable";
|
import Spottable from "@enact/spotlight/Spottable";
|
||||||
|
import Spotlight from "@enact/spotlight";
|
||||||
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
import Marquee from "@enact/sandstone/Marquee";
|
||||||
|
import CustomImage from "../../../components/CustomImage/CustomImage";
|
||||||
|
import css from "./Template.module.less";
|
||||||
|
import Random from "./RandomUnit";
|
||||||
|
import Rolling from "./RollingUnit";
|
||||||
|
|
||||||
import testimg from "../../../../assets/h430054.webp";
|
import testimg from "../../../../assets/h430054.webp";
|
||||||
import banner2 from "../../../../assets/Image/img-home-banner-h-02.png";
|
import banner2 from "../../../../assets/Image/img-home-banner-h-02.png";
|
||||||
import banner4 from "../../../../assets/Image/img-home-banner-v-02.png";
|
import banner4 from "../../../../assets/Image/img-home-banner-v-02.png";
|
||||||
import banner3 from "../../../../assets/images/mainTemplate/img-home-banner-td-ver.svg";
|
import banner3 from "../../../../assets/images/mainTemplate/img-home-banner-td-ver.svg";
|
||||||
import HomeTodayDeal from "../HomeTodayDeal/HomeTodayDeal";
|
import HomeTodayDeal from "../HomeTodayDeal/HomeTodayDeal";
|
||||||
import css from "./Template.module.less";
|
|
||||||
|
|
||||||
const SpottableComponent = Spottable("div");
|
const SpottableComponent = Spottable("div");
|
||||||
|
|
||||||
@@ -21,36 +26,166 @@ const Container = SpotlightContainerDecorator(
|
|||||||
"div"
|
"div"
|
||||||
);
|
);
|
||||||
|
|
||||||
export default function HomeBannerTemplate3() {
|
export default function HomeBannerTemplate3({ isOnTop, spotlightId, onScrollTop, onScrollShelf, homeMainContentsBannerInfos, homeTopDisplayInfos, ...rest }) {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const [bannerImageLoaded, setBannerImageLoaded] = useState(false);
|
||||||
|
|
||||||
|
const [baner1Index, setBaner1Index] = useState("");
|
||||||
|
const [baner2Index, setBaner2Index] = useState("");
|
||||||
|
const [baner3Index, setBaner3Index] = useState("");
|
||||||
|
const [baner4Index, setBaner4Index] = useState("");
|
||||||
|
|
||||||
|
const [baner1Data, setBaner1Data] = useState([]);
|
||||||
|
const [baner2Data, setBaner2Data] = useState([]);
|
||||||
|
const [baner3Data, setBaner3Data] = useState([]);
|
||||||
|
const [baner4Data, setBaner4Data] = useState([]);
|
||||||
|
|
||||||
|
const bannerInfos = homeMainContentsBannerInfos[0].bannerInfos;
|
||||||
|
|
||||||
|
// 배너가 없는 경우, 대체용 배너 [수직]
|
||||||
|
const replaceBannerVtctp = useCallback(() => {
|
||||||
|
let imgPath = "";
|
||||||
|
|
||||||
|
if(homeTopDisplayInfos[0].vtctpImgPath1 == "" || homeTopDisplayInfos[0].vtctpImgPath1 == null){
|
||||||
|
imgPath = homeTopDisplayInfos[0].vtctpImgPath2;
|
||||||
|
}else{
|
||||||
|
imgPath = homeTopDisplayInfos[0].vtctpImgPath1;
|
||||||
|
}
|
||||||
|
return imgPath;
|
||||||
|
},[]);
|
||||||
|
|
||||||
|
// 배너가 없는 경우, 대체용 배너 [수직]
|
||||||
|
const replaceBannerWdth = useCallback(() => {
|
||||||
|
let imgPath = "";
|
||||||
|
|
||||||
|
if(homeTopDisplayInfos[0].wdthtpImgPath1 == "" || homeTopDisplayInfos[0].wdthtpImgPath1 == null){
|
||||||
|
imgPath = homeTopDisplayInfos[0].wdthtpImgPath2;
|
||||||
|
}else{
|
||||||
|
imgPath = homeTopDisplayInfos[0].wdthtpImgPath1;
|
||||||
|
}
|
||||||
|
return imgPath;
|
||||||
|
},[]);
|
||||||
|
|
||||||
|
const onClickBanner = useCallback(() => {
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
bannerInfos.forEach((el, index) => {
|
||||||
|
if(el.banrLctnNo == "1"){
|
||||||
|
setBaner1Data(el);
|
||||||
|
setBaner1Index(index);
|
||||||
|
}
|
||||||
|
else if(el.banrLctnNo == "2"){
|
||||||
|
setBaner2Data(el);
|
||||||
|
setBaner2Index(index);
|
||||||
|
}
|
||||||
|
else if(el.banrLctnNo == "3"){
|
||||||
|
setBaner3Data(el);
|
||||||
|
setBaner3Index(index);
|
||||||
|
}
|
||||||
|
else if(el.banrLctnNo == "4"){
|
||||||
|
setBaner4Data(el);
|
||||||
|
setBaner4Index(index);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
console.log(homeMainContentsBannerInfos, "메인 컨텐츠");
|
||||||
|
console.log(homeTopDisplayInfos, "탑디스");
|
||||||
|
}, [homeMainContentsBannerInfos]);
|
||||||
|
|
||||||
const homeMainContentsBannerInfos = useSelector(
|
|
||||||
(state) => state.home.mainContentsData.homeMainContentsBannerInfos
|
|
||||||
);
|
|
||||||
const testchk = useSelector((state) => state);
|
|
||||||
console.log("##", testchk);
|
|
||||||
return (
|
return (
|
||||||
<Container className={css.homeTemplateBox}>
|
<Container className={css.homeTemplateBox}>
|
||||||
{homeMainContentsBannerInfos &&
|
|
||||||
homeMainContentsBannerInfos.map((bannerInfos) => {
|
|
||||||
return (
|
|
||||||
<HomeTodayDeal
|
|
||||||
homeMainContentsBannerInfos={homeMainContentsBannerInfos}
|
|
||||||
//가로형일때는 isHorizontal 넣어주면됨.
|
|
||||||
rolling={false}
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
})}
|
|
||||||
<div class={css.mainBox}>
|
<div class={css.mainBox}>
|
||||||
<SpottableComponent className={css.imgBox}>
|
<SpottableComponent className={css.imgBox}>
|
||||||
<img src={banner4} />
|
{baner1Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
|
<Rolling
|
||||||
|
banerData={baner1Data}
|
||||||
|
/>
|
||||||
|
) : baner1Data.shptmDspyTpNm == "Random" ? (
|
||||||
|
<Random
|
||||||
|
banerData={baner1Data}
|
||||||
|
/>
|
||||||
|
) :
|
||||||
|
<CustomImage
|
||||||
|
className={""}
|
||||||
|
delay={0}
|
||||||
|
onClickBanner={onClickBanner}
|
||||||
|
onImageLoaded={""}
|
||||||
|
src={replaceBannerVtctp}
|
||||||
|
hide={""}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</SpottableComponent>
|
</SpottableComponent>
|
||||||
|
|
||||||
|
<SpottableComponent className={css.imgBox}>
|
||||||
|
{baner2Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
|
// 롤링으로 변경하기 구현 준비 중
|
||||||
|
<CustomImage
|
||||||
|
className={""}
|
||||||
|
delay={0}
|
||||||
|
onClickBanner={onClickBanner}
|
||||||
|
onImageLoaded={""}
|
||||||
|
src={replaceBannerVtctp}
|
||||||
|
hide={""}
|
||||||
|
/>
|
||||||
|
) : baner2Data.shptmDspyTpNm == "Random" ? (
|
||||||
|
<Random
|
||||||
|
banerData={baner2Data}
|
||||||
|
/>
|
||||||
|
) :
|
||||||
|
<CustomImage
|
||||||
|
className={""}
|
||||||
|
delay={0}
|
||||||
|
onClickBanner={onClickBanner}
|
||||||
|
onImageLoaded={""}
|
||||||
|
src={replaceBannerVtctp}
|
||||||
|
hide={""}
|
||||||
|
/>
|
||||||
|
}
|
||||||
|
</SpottableComponent>
|
||||||
|
|
||||||
<div className={css.dualBox}>
|
<div className={css.dualBox}>
|
||||||
<SpottableComponent className={css.videoBox}>
|
<SpottableComponent className={css.videoBox}>
|
||||||
<img src={banner2} />
|
{baner3Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
|
<Rolling
|
||||||
|
banerData={baner3Data}
|
||||||
|
/>
|
||||||
|
) : baner3Data.shptmDspyTpNm == "Random" ? (
|
||||||
|
<Random
|
||||||
|
banerData={baner3Data}
|
||||||
|
/>
|
||||||
|
) :
|
||||||
|
<CustomImage
|
||||||
|
className={""}
|
||||||
|
delay={0}
|
||||||
|
onClickBanner={onClickBanner}
|
||||||
|
onImageLoaded={""}
|
||||||
|
src={replaceBannerWdth}
|
||||||
|
hide={""}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</SpottableComponent>
|
</SpottableComponent>
|
||||||
|
|
||||||
<SpottableComponent className={css.slideBox}>
|
<SpottableComponent className={css.slideBox}>
|
||||||
<img src={banner2} />
|
{baner4Data.shptmDspyTpNm == "Rolling" ? (
|
||||||
|
<Rolling
|
||||||
|
banerData={baner4Data}
|
||||||
|
/>
|
||||||
|
) : baner4Data.shptmDspyTpNm == "Random" ? (
|
||||||
|
<Random
|
||||||
|
banerData={baner4Data}
|
||||||
|
/>
|
||||||
|
) :
|
||||||
|
<CustomImage
|
||||||
|
className={""}
|
||||||
|
delay={0}
|
||||||
|
onClickBanner={onClickBanner}
|
||||||
|
onImageLoaded={""}
|
||||||
|
src={replaceBannerWdth}
|
||||||
|
hide={""}
|
||||||
|
/>
|
||||||
|
}
|
||||||
</SpottableComponent>
|
</SpottableComponent>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
import React, { useEffect, memo, useState, useRef, useCallback } from "react";
|
||||||
|
import TodayDeal from "../HomeTodayDeal/HomeTodayDeal";
|
||||||
|
import CustomImage from "../../../components/CustomImage/CustomImage";
|
||||||
|
import css from "./Template.module.less";
|
||||||
|
import VideoPlay from "@enact/sandstone/VideoPlayer";
|
||||||
|
|
||||||
|
export default function RandomUnit({ banerData }) {
|
||||||
|
|
||||||
|
const bannerDetailInfos = banerData.bannerDetailInfos;
|
||||||
|
const [randomData, setRandomData] = useState([]);
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
|
if(bannerDetailInfos){
|
||||||
|
const leng = banerData.bannerDetailInfos.length;
|
||||||
|
const num = Math.floor(Math.random() * leng);
|
||||||
|
setRandomData(bannerDetailInfos[num]);
|
||||||
|
}
|
||||||
|
}, [banerData]);
|
||||||
|
|
||||||
|
return(
|
||||||
|
<>
|
||||||
|
{randomData.shptmBanrTpNm == "Image Banner" ? (
|
||||||
|
<p>TEST</p>
|
||||||
|
) : randomData.shptmBanrTpNm == "LIVE" || randomData.shptmBanrTpNm == "VOD" ? (
|
||||||
|
<p>비디오</p>
|
||||||
|
) : randomData.shptmBanrTpNm == "Today's Deals" || randomData.shptmBanrTpNm == "" ? (
|
||||||
|
<TodayDeal
|
||||||
|
banerData={randomData}
|
||||||
|
isHorizontal={true}
|
||||||
|
/>
|
||||||
|
) : null
|
||||||
|
}
|
||||||
|
</>
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import React, { useEffect, memo, useState, useRef } from "react";
|
||||||
|
import CustomImage from "../../../components/CustomImage/CustomImage";
|
||||||
|
import banerImage3 from "../../../../assets/Image/img-home-banner-v-01.png";
|
||||||
|
import css from "./Template.module.less";
|
||||||
|
import VideoPlay from "@enact/sandstone/VideoPlayer";
|
||||||
|
|
||||||
|
export default function RollingUnit({ banerData }) {
|
||||||
|
|
||||||
|
useEffect(()=> {
|
||||||
|
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
return(
|
||||||
|
<p>TEST</p>
|
||||||
|
)
|
||||||
|
};
|
||||||
@@ -1,69 +1,98 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, {useCallback, useEffect, useState} from "react";
|
||||||
|
|
||||||
import { useDispatch, useSelector } from "react-redux";
|
import { useDispatch, useSelector } from "react-redux";
|
||||||
|
|
||||||
import TPanel from "../../components/TPanel/TPanel";
|
import TPanel from "../../components/TPanel/TPanel";
|
||||||
import { $L } from "../../utils/helperMethods";
|
|
||||||
import BestSeller from "../HomePanel/BestSeller/BestSeller";
|
import BestSeller from "../HomePanel/BestSeller/BestSeller";
|
||||||
import HomeOnSale from "../HomePanel/HomeOnSale/HomeOnSale";
|
import HomeOnSale from "../HomePanel/HomeOnSale/HomeOnSale";
|
||||||
import css from "../HomePanel/HomePanel.module.less";
|
import css from "../HomePanel/HomePanel.module.less";
|
||||||
import PopularShow from "../HomePanel/PopularShow/PopularShow";
|
import PopularShow from "../HomePanel/PopularShow/PopularShow";
|
||||||
import SubCategory from "../HomePanel/SubCategory/SubCategory";
|
import SubCategory from "../HomePanel/SubCategory/SubCategory";
|
||||||
import HomeTemplate from "./HomeTemplate";
|
import HomeBannerTemplate1 from "../HomePanel/HomeBanner/HomeBannerTemplate1";
|
||||||
|
import HomeBannerTemplate2 from "../HomePanel/HomeBanner/HomeBannerTemplate2";
|
||||||
|
import HomeBannerTemplate3 from "../HomePanel/HomeBanner/HomeBannerTemplate3";
|
||||||
|
|
||||||
export default function HomePanel() {
|
export default function HomePanel() {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
const homeLayoutInfo = useSelector((state) => state.home.layoutData);
|
||||||
const latoutData = useSelector((state) => state.home.layoutData);
|
|
||||||
const homeMainContentsBannerInfos = useSelector(
|
const homeMainContentsBannerInfos = useSelector(
|
||||||
(state) => state.home.mainContentsData.homeMainContentsBannerInfos
|
(state) => state.home.mainContentsData.homeMainContentsBannerInfos
|
||||||
);
|
);
|
||||||
const homeTopDisplayInfos = useSelector(
|
const homeTopDisplayInfos = useSelector(
|
||||||
(state) => state.home.mainContentsData.homeTopDisplayInfos
|
(state) => state.home.mainContentsData.homeTopDisplayInfos
|
||||||
);
|
);
|
||||||
const [selectTemplate, setSelectTemplate] = useState(null);
|
|
||||||
|
|
||||||
const getHomeLayout = () => {};
|
const [select, setSelect] = useState(null);
|
||||||
|
const [homeLayoutInfoDetail, setHomeLayoutInfoDetail] = useState([]);
|
||||||
const getHomeContents = () => {
|
// 추후 스위치 select 로 변경 : 스팟라이트 테스트 중
|
||||||
// 추후 다시 한번 확인: 코드(DSP00201, 202, 203)
|
const selectSwitch = () =>{
|
||||||
// 템플릿 선택
|
switch ("DSP00203") {
|
||||||
let tempTemplate = 0;
|
case "DSP00201":
|
||||||
|
return(
|
||||||
if (homeTopDisplayInfos) {
|
<HomeBannerTemplate1
|
||||||
if (homeTopDisplayInfos[0].shptmTmplCd == "DSP00201") {
|
isOnTop={""}
|
||||||
tempTemplate = 1;
|
spotlightId={""}
|
||||||
}
|
onScrollTop={""}
|
||||||
if (homeTopDisplayInfos[0].shptmTmplCd == "DSP00202") {
|
onScrollShelf={""}
|
||||||
tempTemplate = 2;
|
homeMainContentsBannerInfos={homeMainContentsBannerInfos}
|
||||||
}
|
homeTopDisplayInfos={homeTopDisplayInfos}
|
||||||
if (homeTopDisplayInfos[0].shptmTmplCd == "DSP00203") {
|
/>
|
||||||
tempTemplate = 3;
|
)
|
||||||
}
|
case "DSP00202":
|
||||||
|
return(
|
||||||
|
<HomeBannerTemplate2
|
||||||
|
isOnTop={""}
|
||||||
|
spotlightId={""}
|
||||||
|
onScrollTop={""}
|
||||||
|
onScrollShelf={""}
|
||||||
|
homeMainContentsBannerInfos={homeMainContentsBannerInfos}
|
||||||
|
homeTopDisplayInfos={homeTopDisplayInfos}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
case "DSP00203":
|
||||||
|
return(
|
||||||
|
<HomeBannerTemplate3
|
||||||
|
isOnTop={""}
|
||||||
|
spotlightId={""}
|
||||||
|
onScrollTop={""}
|
||||||
|
onScrollShelf={""}
|
||||||
|
homeMainContentsBannerInfos={homeMainContentsBannerInfos}
|
||||||
|
homeTopDisplayInfos={homeTopDisplayInfos}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
default:
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
setSelectTemplate(tempTemplate);
|
}
|
||||||
};
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
getHomeLayout();
|
if(homeTopDisplayInfos){
|
||||||
getHomeContents();
|
setSelect(homeTopDisplayInfos[0].shptmTmplCd);
|
||||||
}, []);
|
}
|
||||||
|
if(homeLayoutInfo){
|
||||||
|
setHomeLayoutInfoDetail(homeLayoutInfo.homeLayoutInfo);
|
||||||
|
}
|
||||||
|
selectSwitch();
|
||||||
|
}, [homeTopDisplayInfos, homeMainContentsBannerInfos, homeLayoutInfo, select]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TPanel className={css.panelDesign}>
|
<TPanel className={css.panelDesign}>
|
||||||
<HomeTemplate
|
{homeLayoutInfoDetail &&
|
||||||
isOnTop={""}
|
homeLayoutInfoDetail.map((item, index)=> {
|
||||||
spotlightId={""}
|
return(
|
||||||
onScrollTop={""}
|
item.shptmApphmDspyOptCd == "DSP00101" ? (
|
||||||
onScrollShelf={""}
|
selectSwitch()
|
||||||
selectTemplate={selectTemplate}
|
) : item.shptmApphmDspyOptCd == "DSP00102" ? (
|
||||||
// homeMainContentsBannerInfos={homeMainContentsBannerInfos}
|
<SubCategory />
|
||||||
// homeTopDisplayInfos={homeTopDisplayInfos}
|
) : item.shptmApphmDspyOptCd == "DSP00105" ? (
|
||||||
/>
|
<BestSeller />
|
||||||
<SubCategory />
|
) : item.shptmApphmDspyOptCd == "DSP00103" ? (
|
||||||
<HomeOnSale />
|
<HomeOnSale />
|
||||||
<PopularShow />
|
) : item.shptmApphmDspyOptCd == "DSP00104" ? (
|
||||||
<BestSeller />
|
<PopularShow />
|
||||||
|
) : null
|
||||||
|
)})
|
||||||
|
}
|
||||||
</TPanel>
|
</TPanel>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
import React, { memo } from "react";
|
|
||||||
|
|
||||||
import HomeBannerTemplate1 from "../HomePanel/HomeBanner/HomeBannerTemplate1";
|
|
||||||
import HomeBannerTemplate2 from "../HomePanel/HomeBanner/HomeBannerTemplate2";
|
|
||||||
import HomeBannerTemplate3 from "../HomePanel/HomeBanner/HomeBannerTemplate3";
|
|
||||||
|
|
||||||
export default memo (function HomeTemplate({isOnTop, spotlightId, onScrollTop, onScrollShelf, selectTemplate, ...rest}) {
|
|
||||||
|
|
||||||
|
|
||||||
let SelectedTemplate = null;
|
|
||||||
|
|
||||||
switch (selectTemplate) {
|
|
||||||
case 1:
|
|
||||||
SelectedTemplate = HomeBannerTemplate1;
|
|
||||||
break;
|
|
||||||
case 2:
|
|
||||||
SelectedTemplate = HomeBannerTemplate2;
|
|
||||||
break;
|
|
||||||
case 3:
|
|
||||||
SelectedTemplate = HomeBannerTemplate3;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return SelectedTemplate ? (
|
|
||||||
<SelectedTemplate
|
|
||||||
isOnTop={""}
|
|
||||||
spotlightId={""}
|
|
||||||
onScrollTop={""}
|
|
||||||
onScrollShelf={""}
|
|
||||||
/>
|
|
||||||
) : null;
|
|
||||||
})
|
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
import React from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
@@ -12,22 +12,29 @@ export default function HomeTodayDeal({
|
|||||||
homeMainContentsBannerInfos,
|
homeMainContentsBannerInfos,
|
||||||
isHorizontal,
|
isHorizontal,
|
||||||
rolling,
|
rolling,
|
||||||
|
banerData,
|
||||||
...rest
|
...rest
|
||||||
}) {
|
}) {
|
||||||
const bannerDetailInfos =
|
|
||||||
homeMainContentsBannerInfos[0].bannerInfos[0].bannerDetailInfos[0];
|
const [salePrice, setSalePrice] = useState("");
|
||||||
const priceInfo = bannerDetailInfos.priceInfo;
|
const [originalPrice, setOriginalPrice] = useState("");
|
||||||
let salePrice;
|
|
||||||
const originalPrice = priceInfo.split("|")[0];
|
useEffect(() => {
|
||||||
if (priceInfo.split("|")[3] == "") {
|
if(banerData){
|
||||||
salePrice = priceInfo.split("|")[1];
|
const priceInfo = banerData.priceInfo;
|
||||||
}
|
setOriginalPrice(priceInfo.split("|")[0]);
|
||||||
|
if (priceInfo.split("|")[3] == "") {
|
||||||
|
setSalePrice(priceInfo.split("|")[1]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [banerData]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SpottableComponent
|
<SpottableComponent
|
||||||
className={classNames(css.itemBox, isHorizontal && css.isHorizontal)}
|
className={classNames(css.itemBox, isHorizontal && css.isHorizontal)}
|
||||||
>
|
>
|
||||||
<div>
|
<div>
|
||||||
<div className={css.textBox}>{bannerDetailInfos.prdtNm}</div>
|
<div className={css.textBox}>{banerData.prdtNm}</div>
|
||||||
<div className={css.accBox}>
|
<div className={css.accBox}>
|
||||||
{salePrice}
|
{salePrice}
|
||||||
{salePrice != originalPrice ? (
|
{salePrice != originalPrice ? (
|
||||||
@@ -38,7 +45,7 @@ export default function HomeTodayDeal({
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className={css.itemImgBox}>
|
<div className={css.itemImgBox}>
|
||||||
<img src={bannerDetailInfos.tmnlImgNm} />
|
<img src={banerData.tmnlImgNm} />
|
||||||
</div>
|
</div>
|
||||||
{rolling == true ? (
|
{rolling == true ? (
|
||||||
<>
|
<>
|
||||||
@@ -49,5 +56,6 @@ export default function HomeTodayDeal({
|
|||||||
<></>
|
<></>
|
||||||
)}
|
)}
|
||||||
</SpottableComponent>
|
</SpottableComponent>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user