From e4f6713dc8ad31b515400e72e8e5bfce2108e002 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B3=A0=EB=8F=99=EC=98=81?= Date: Fri, 16 Feb 2024 15:02:53 +0900 Subject: [PATCH] detail component rename and style update --- .../src/reducers/panelReducer.js | 2 +- .../src/views/DetailPanel/DetailPanel.jsx | 6 ++-- .../DetailPanel/components/Indicator.jsx | 14 +++++--- .../components/Indicator.module.less | 18 ++++------- .../ProductThumbnail.jsx} | 18 ++++------- .../container/ProductThumbnail.module.less | 32 +++++++++++++++++++ 6 files changed, 57 insertions(+), 33 deletions(-) rename com.twin.app.shoptime/src/views/DetailPanel/{layout/ItemImage.jsx => container/ProductThumbnail.jsx} (58%) create mode 100644 com.twin.app.shoptime/src/views/DetailPanel/container/ProductThumbnail.module.less diff --git a/com.twin.app.shoptime/src/reducers/panelReducer.js b/com.twin.app.shoptime/src/reducers/panelReducer.js index eb23f66b..4d1f7035 100644 --- a/com.twin.app.shoptime/src/reducers/panelReducer.js +++ b/com.twin.app.shoptime/src/reducers/panelReducer.js @@ -2,7 +2,7 @@ import { types } from "../actions/actionTypes"; import { panel_names } from "../utils/Config"; const initialState = { - panels: [], + panels: [{ name: panel_names.DETAIL_PANEL }], isModalOpen: false, }; diff --git a/com.twin.app.shoptime/src/views/DetailPanel/DetailPanel.jsx b/com.twin.app.shoptime/src/views/DetailPanel/DetailPanel.jsx index 25402e74..607ce146 100644 --- a/com.twin.app.shoptime/src/views/DetailPanel/DetailPanel.jsx +++ b/com.twin.app.shoptime/src/views/DetailPanel/DetailPanel.jsx @@ -6,9 +6,8 @@ import { getMainCategoryDetail } from "../../actions/mainActions"; import TBody from "../../components/TBody/TBody"; import THeader from "../../components/THeader/THeader"; import TPanel from "../../components/TPanel/TPanel"; +import ProductThumbnail from "./container/ProductThumbnail"; import css from "./DetailPanel.module.less"; -import ItemImage from "./layout/ItemImage"; -import OptionList from "./layout/OptionList"; export default function ItemDetail() { const [selectedPatnrId, setSelectedPatnrId] = useState(1); @@ -38,8 +37,7 @@ export default function ItemDetail() { onBackButton /> - - + ); diff --git a/com.twin.app.shoptime/src/views/DetailPanel/components/Indicator.jsx b/com.twin.app.shoptime/src/views/DetailPanel/components/Indicator.jsx index 5914e413..f955c6c1 100644 --- a/com.twin.app.shoptime/src/views/DetailPanel/components/Indicator.jsx +++ b/com.twin.app.shoptime/src/views/DetailPanel/components/Indicator.jsx @@ -1,5 +1,6 @@ import React, { useEffect, useState } from "react"; +import classNames from "classnames"; import { useSelector } from "react-redux"; import Image from "@enact/sandstone/Image"; @@ -10,11 +11,10 @@ import css from "./Indicator.module.less"; const SpottableComponent = Spottable("button"); export default function Indicator() { + const images = useSelector((state) => state.main.productImages); const [selectedImage, setSelectedImage] = useState(null); const [selectedIndex, setSelectedIndex] = useState(0); - const images = useSelector((state) => state.main.productImages); - useEffect(() => { if (images && images.length > 0) { setSelectedImage(images[0]); @@ -39,8 +39,9 @@ export default function Indicator() { }); }; - const handleItemClick = (image) => { + const handleItemClick = (image, index) => { setSelectedImage(image); + setSelectedIndex(index); }; return ( @@ -61,9 +62,12 @@ export default function Indicator() { key={index} src={image} alt={""} - onClick={() => handleItemClick(image)} + onClick={() => handleItemClick(image, index)} selected={selectedIndex === index} - className={css.image} + className={classNames( + css.image, + selectedIndex === index && css.selected + )} /> ))} { - if (productData) { - setImages(productData?.imgUrls); - } - }, [productData, images]); +export default function ProductThumbnail() { + const productData = useSelector((state) => state.main.productData); return ( - +
{$L("Call to Order")}
diff --git a/com.twin.app.shoptime/src/views/DetailPanel/container/ProductThumbnail.module.less b/com.twin.app.shoptime/src/views/DetailPanel/container/ProductThumbnail.module.less new file mode 100644 index 00000000..fd33d484 --- /dev/null +++ b/com.twin.app.shoptime/src/views/DetailPanel/container/ProductThumbnail.module.less @@ -0,0 +1,32 @@ +@import '../../../style/CommonStyle.module.less'; +@import "../../../style/utils.module.less"; + +.Wrap { + padding-left: 120px; + .size(@w: 894px, @h: 930px); + + .order { + .font(@fontFamily: @baseFontBold, @fontSize: 30px); + .size(@w: 560px, @h: 68px); + display: flex; + justify-content: space-between; + line-height: 68px; + background-color: #f2f2f2; + + margin-top: 10px; + > div { + padding: 0 33px 0 30px; + } + } + .icon { + display: flex; + > span { + .size(@w: 42px, @h: 42px); + background-image: url("../../../../assets/icon/ic-gr-call.svg"); + background-size: cover; + background-position: center; + margin: 13px 0 0 4px ; + } + } + +}