detail component rename and style update
This commit is contained in:
@@ -2,7 +2,7 @@ import { types } from "../actions/actionTypes";
|
|||||||
import { panel_names } from "../utils/Config";
|
import { panel_names } from "../utils/Config";
|
||||||
|
|
||||||
const initialState = {
|
const initialState = {
|
||||||
panels: [],
|
panels: [{ name: panel_names.DETAIL_PANEL }],
|
||||||
isModalOpen: false,
|
isModalOpen: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6,9 +6,8 @@ import { getMainCategoryDetail } from "../../actions/mainActions";
|
|||||||
import TBody from "../../components/TBody/TBody";
|
import TBody from "../../components/TBody/TBody";
|
||||||
import THeader from "../../components/THeader/THeader";
|
import THeader from "../../components/THeader/THeader";
|
||||||
import TPanel from "../../components/TPanel/TPanel";
|
import TPanel from "../../components/TPanel/TPanel";
|
||||||
|
import ProductThumbnail from "./container/ProductThumbnail";
|
||||||
import css from "./DetailPanel.module.less";
|
import css from "./DetailPanel.module.less";
|
||||||
import ItemImage from "./layout/ItemImage";
|
|
||||||
import OptionList from "./layout/OptionList";
|
|
||||||
|
|
||||||
export default function ItemDetail() {
|
export default function ItemDetail() {
|
||||||
const [selectedPatnrId, setSelectedPatnrId] = useState(1);
|
const [selectedPatnrId, setSelectedPatnrId] = useState(1);
|
||||||
@@ -38,8 +37,7 @@ export default function ItemDetail() {
|
|||||||
onBackButton
|
onBackButton
|
||||||
/>
|
/>
|
||||||
<TBody className={css.container} scrollable={false}>
|
<TBody className={css.container} scrollable={false}>
|
||||||
<ItemImage productData={productData} />
|
<ProductThumbnail productData={productData} />
|
||||||
<OptionList />
|
|
||||||
</TBody>
|
</TBody>
|
||||||
</TPanel>
|
</TPanel>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React, { useEffect, useState } from "react";
|
||||||
|
|
||||||
|
import classNames from "classnames";
|
||||||
import { useSelector } from "react-redux";
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
import Image from "@enact/sandstone/Image";
|
import Image from "@enact/sandstone/Image";
|
||||||
@@ -10,11 +11,10 @@ import css from "./Indicator.module.less";
|
|||||||
const SpottableComponent = Spottable("button");
|
const SpottableComponent = Spottable("button");
|
||||||
|
|
||||||
export default function Indicator() {
|
export default function Indicator() {
|
||||||
|
const images = useSelector((state) => state.main.productImages);
|
||||||
const [selectedImage, setSelectedImage] = useState(null);
|
const [selectedImage, setSelectedImage] = useState(null);
|
||||||
const [selectedIndex, setSelectedIndex] = useState(0);
|
const [selectedIndex, setSelectedIndex] = useState(0);
|
||||||
|
|
||||||
const images = useSelector((state) => state.main.productImages);
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (images && images.length > 0) {
|
if (images && images.length > 0) {
|
||||||
setSelectedImage(images[0]);
|
setSelectedImage(images[0]);
|
||||||
@@ -39,8 +39,9 @@ export default function Indicator() {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleItemClick = (image) => {
|
const handleItemClick = (image, index) => {
|
||||||
setSelectedImage(image);
|
setSelectedImage(image);
|
||||||
|
setSelectedIndex(index);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -61,9 +62,12 @@ export default function Indicator() {
|
|||||||
key={index}
|
key={index}
|
||||||
src={image}
|
src={image}
|
||||||
alt={""}
|
alt={""}
|
||||||
onClick={() => handleItemClick(image)}
|
onClick={() => handleItemClick(image, index)}
|
||||||
selected={selectedIndex === index}
|
selected={selectedIndex === index}
|
||||||
className={css.image}
|
className={classNames(
|
||||||
|
css.image,
|
||||||
|
selectedIndex === index && css.selected
|
||||||
|
)}
|
||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
<SpottableComponent
|
<SpottableComponent
|
||||||
|
|||||||
@@ -5,15 +5,11 @@
|
|||||||
margin: 30px 0 0 10px;
|
margin: 30px 0 0 10px;
|
||||||
height: 560px;
|
height: 560px;
|
||||||
display: flex;
|
display: flex;
|
||||||
|
|
||||||
|
|
||||||
.thumbnail {
|
.thumbnail {
|
||||||
.size(@w: 560px, @h: 560px);
|
.size(@w: 560px, @h: 560px);
|
||||||
border: solid 1px #dadada;
|
border: solid 1px #dadada;
|
||||||
// background-color: #fff;
|
background-color: #fff;
|
||||||
//margin: 30px 10px 10px 0 ;
|
margin-right: 10px;
|
||||||
background-color: red;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.upButton {
|
.upButton {
|
||||||
@@ -29,18 +25,16 @@
|
|||||||
.downButton {
|
.downButton {
|
||||||
.size(@w: 144px , @h: 48px);
|
.size(@w: 144px , @h: 48px);
|
||||||
border: none;
|
border: none;
|
||||||
margin-top: 10px;
|
margin-top: 4px;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-image: url('../../../../assets/button/etc/btn-bk-down-nor.svg');
|
background-image: url('../../../../assets/button/etc/btn-bk-down-nor.svg');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
.image {
|
.image {
|
||||||
margin: 0;
|
margin: 0 0 6px 0;
|
||||||
// border: solid 1px #dadada;
|
border: solid 1px #dadada;
|
||||||
.size(@w: 140px , @h: 140px);
|
.size(@w: 144px , @h: 144px);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,25 +1,21 @@
|
|||||||
import React, { useEffect, useState } from "react";
|
import React from "react";
|
||||||
|
|
||||||
|
import { useSelector } from "react-redux";
|
||||||
|
|
||||||
import Spottable from "@enact/spotlight/Spottable";
|
import Spottable from "@enact/spotlight/Spottable";
|
||||||
|
|
||||||
import { $L } from "../../../utils/helperMethods";
|
import { $L } from "../../../utils/helperMethods";
|
||||||
import Indicator from "../components/Indicator";
|
import Indicator from "../components/Indicator";
|
||||||
import css from "../layout/ItemImage.module.less";
|
import css from "./ProductThumbnail.module.less";
|
||||||
|
|
||||||
const SpottableComponent = Spottable("div");
|
const SpottableComponent = Spottable("div");
|
||||||
|
|
||||||
export default function ItemImage({ productData }) {
|
export default function ProductThumbnail() {
|
||||||
const [images, setImages] = useState();
|
const productData = useSelector((state) => state.main.productData);
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
if (productData) {
|
|
||||||
setImages(productData?.imgUrls);
|
|
||||||
}
|
|
||||||
}, [productData, images]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<SpottableComponent className={css.Wrap}>
|
<SpottableComponent className={css.Wrap}>
|
||||||
<Indicator images={images} />
|
<Indicator />
|
||||||
<div className={css.order}>
|
<div className={css.order}>
|
||||||
<div>{$L("Call to Order")}</div>
|
<div>{$L("Call to Order")}</div>
|
||||||
<div className={css.icon}>
|
<div className={css.icon}>
|
||||||
@@ -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 ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user