디테일 패널 Tscroll 커스텀 작업

This commit is contained in:
고동영
2024-02-26 18:28:14 +09:00
parent c2b6b24449
commit e7e208bd38
4 changed files with 110 additions and 14 deletions

View File

@@ -92,6 +92,12 @@
img {
.size(@w: 200px, @h: 200px);
}
.buttonContainer {
display: flex;
justify-content: center;
margin-top: 22px;
}
}
.textPopup,
.exitPopup {

View File

@@ -41,7 +41,9 @@ const TabItemBase = ({
clearPressedJob.current.start(() => {
if (onClick) {
onClick({ index, target });
setLastFocusId(spotlightId);
if (spotlightId) {
setLastFocusId(spotlightId);
}
}
});
},

View File

@@ -1,18 +1,22 @@
import React, { useCallback, useState } from "react";
import React, { useCallback, useEffect, useRef, useState } from "react";
import { useSelector } from "react-redux";
import Spotlight from "@enact/spotlight";
import SpotlightContainerDecorator from "@enact/spotlight/SpotlightContainerDecorator";
import Spottable from "@enact/spotlight/Spottable";
import TButtonTab from "../../../components/TButtonTab/TButtonTab";
import TPopUp from "../../../components/TPopUp/TPopUp";
import TScroller from "../../../components/TScroller/TScroller";
import { $L } from "../../../utils/helperMethods";
import Indicator from "../components/Indicator";
import ProductTag from "../components/ProductTag";
import StarRating from "../components/StarRating";
import css from "./ProductThumbnail.module.less";
const DESCRIPTION =
" Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through thLorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through thorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through they of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through th";
const Container = SpotlightContainerDecorator(
{ enterTo: "last-focused" },
"div"
@@ -21,16 +25,29 @@ const SpottableComponent = Spottable("div");
export default function ProductThumbnail() {
const productData = useSelector((state) => state.main.productData);
const [opened, setOpened] = useState(false);
const [tabLabel, setTabLabel] = useState("");
const tScrollerRef = useRef(null);
const buttonLabel = [
{ label: $L("DESCRIPTION") },
{ label: $L("RETURN & EXCHANGES") },
{ label: $L("SHOP BY MOBILE") },
];
const handlePopUp = () => {
const handlePopUp = (label) => {
setOpened((prev) => !prev);
setTabLabel([label]);
};
const scrollToTop = () => {
if (tScrollerRef.current) {
tScrollerRef.current.scrollToTop();
}
};
const scrollToBottom = () => {
if (tScrollerRef.current) {
tScrollerRef.current.scrollToBottom();
}
};
const tabList = [$L("DESCRIPTION")];
const renderPopUp = () => {
return (
<TPopUp
@@ -38,13 +55,13 @@ export default function ProductThumbnail() {
onClose={handlePopUp}
open={opened}
hasButton
// button1Text={"CLOSE"}
button1Text={"CLOSE"}
>
<div className={css.popUpHeader}>
<img src={productData?.imgUrls600[0]} />
<div className={css.path}>
<div>
<img src={productData?.patncLogoPath} alt="" />{" "}
<img src={productData?.patncLogoPath} alt="" />
<span>{`ID:` + productData?.prdtId}</span>
</div>
<h3>{productData?.prdtNm}</h3>
@@ -58,8 +75,25 @@ export default function ProductThumbnail() {
</div>
</div>
<span className={css.line} />
<TButtonTab selectedIndex={0} contents={tabList} className={css.tab} />
<div>123123213</div>
<div>
<TButtonTab
selectedIndex={0}
contents={tabLabel}
className={css.tab}
/>
<div className={css.content}>
<button className={css.upButton} onClick={scrollToTop} />
<TScroller
className={css.scrollContainer}
verticalScrollbar="auto"
ref={tScrollerRef}
>
<div>{DESCRIPTION}</div>
</TScroller>
<button className={css.downButton} onClick={scrollToBottom} />
</div>
</div>
</TPopUp>
);
};
@@ -78,7 +112,7 @@ export default function ProductThumbnail() {
<div className={css.buttonWrap}>
<div className={css.tButton}>
{buttonLabel.map(({ label }, index) => (
<SpottableComponent onClick={handlePopUp} key={index}>
<SpottableComponent onClick={() => handlePopUp(label)} key={index}>
{label}
</SpottableComponent>
))}

View File

@@ -87,8 +87,10 @@
}
// 상품명
> h3 {
.elip(2);
.font(@fontFamily: @baseFontBold, @fontSize: 36px);
padding: 24px 0 14px 0;
padding-top: 24px;
margin-bottom: 14px;
}
.starRating {
margin-top: 3px;
@@ -99,14 +101,66 @@
justify-content: space-between;
}
}
.line {
.size(@w: 990px , @h: 1px);
margin: 30px 0 30px 0;
background-color: #dadada;
}
.tab {
width: 980px;
}
.content {
.size(@w: 980px , @h: 300px);
padding: 30px 0 0 30px;
background-color: #fff;
border: solid 1px #dadada;
position: relative;
.upButton {
position: absolute;
top: 0px;
left: 928px;
.size(@w: 48px , @h: 48px);
background-image: url("../../../../assets/images/btn/btn-scroll-up-dim.svg");
background-position: center;
background-size: cover;
}
.downButton {
position: absolute;
top: 250px;
left: 928px;
.size(@w: 48px , @h: 48px);
background-image: url("../../../../assets/images/btn/btn-scroll-down-dim.svg");
background-position: center;
background-size: cover;
}
}
.scrollContainer {
.font(@fontFamily: @baseFont, @fontSize: 24px);
color: #808080;
text-align: left;
line-height: 1.3;
position: relative;
> div {
padding-right: 75px;
}
> div:nth-child(2) > div:nth-child(1) {
width: 8px;
height: 182px;
background-color: #e7e7e7;
}
> div:nth-child(2) {
width: 48px;
height: 105px;
margin-top: 15px;
padding-left: 10px;
}
//scrollbar thumb
> div:nth-child(2) > div:nth-child(1) > div {
border-radius: 0px;
height: 100px;
background-color: #7a808d;
}
}