홈패널 마지막부분 여백값 관련 수정

This commit is contained in:
junghoon86.park
2024-05-10 15:46:10 +09:00
parent 6f44e45152
commit 02756e6cbe
4 changed files with 35 additions and 51 deletions

View File

@@ -14,7 +14,7 @@ import useScrollReset from "../../../hooks/useScrollReset";
import useScrollTo from "../../../hooks/useScrollTo"; import useScrollTo from "../../../hooks/useScrollTo";
import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance"; import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance";
import { panel_names } from "../../../utils/Config"; import { panel_names } from "../../../utils/Config";
import { $L } from "../../../utils/helperMethods"; import { $L, scaleW } from "../../../utils/helperMethods";
import css from "./BestSeller.module.less"; import css from "./BestSeller.module.less";
const SpottableComponent = Spottable("div"); const SpottableComponent = Spottable("div");
@@ -94,13 +94,10 @@ const BestSeller = ({ order, scrollTopBody, panelInfo }) => {
const handleScrollRight = (e) => { const handleScrollRight = (e) => {
const container = e.currentTarget?.parentNode; const container = e.currentTarget?.parentNode;
let gap = 18; let gap = scaleW(18);
let itemWidth = 324; let itemWidth = scaleW(324);
let moreItemWidth = 198; let moreItemWidth = scaleW(198);
let containerBoxWidth = 1740; let containerBoxWidth = scaleW(1740);
// const maxVisibleCount = Math.floor((containerWidth - padding) / (itemWidth + gap));
// item의 배열 길이가 5이상 일때 작동해야 함, if maxVisibleCount보다 아이템의 갯수가 작다면 return
let itemLength = bestSellerDatas?.length; let itemLength = bestSellerDatas?.length;
const x = const x =
@@ -152,7 +149,7 @@ const BestSeller = ({ order, scrollTopBody, panelInfo }) => {
onBlur={() => handleBlur(itemIndex)} onBlur={() => handleBlur(itemIndex)}
onClick={() => handleCardClick(patnrId, prdtId)} onClick={() => handleCardClick(patnrId, prdtId)}
offerInfo={offerInfo} offerInfo={offerInfo}
spotlightId={'bestsellerItem'+itemIndex} spotlightId={"bestsellerItem" + itemIndex}
/> />
) )
)} )}

View File

@@ -9,7 +9,7 @@ import TScroller from "../../../components/TScroller/TScroller";
import useScrollReset from "../../../hooks/useScrollReset"; import useScrollReset from "../../../hooks/useScrollReset";
import useScrollTo from "../../../hooks/useScrollTo"; import useScrollTo from "../../../hooks/useScrollTo";
import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance"; import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance";
import { $L } from "../../../utils/helperMethods"; import { $L, scaleW } from "../../../utils/helperMethods";
import css from "./HomeOnSale.module.less"; import css from "./HomeOnSale.module.less";
import HomeOnSaleItem from "./HomeOnSaleItem/HomeOnSaleItem"; import HomeOnSaleItem from "./HomeOnSaleItem/HomeOnSaleItem";
@@ -30,12 +30,30 @@ const HomeOnSale = ({ order, scrollTopBody, ...rest }) => {
scrollLeft, scrollLeft,
true true
); );
const homeOnSaleInfosLength = homeOnSaleInfos?.length;
const handleScrollRight = () => {
let gap = scaleW(18);
let itemWidth = scaleW(630);
let containerBoxWidth = scaleW(1740);
const x = (itemWidth + gap) * homeOnSaleInfosLength - containerBoxWidth;
setTimeout(() => {
scrollLeft({ x, animate: true });
});
};
const handleFocus = useCallback( const handleFocus = useCallback(
(index) => { (index) => {
if (index === 0) { if (index === 0) {
handleScrollReset(); handleScrollReset();
} }
if (index === homeOnSaleInfosLength - 1) {
handleScrollRight();
}
if (cursorVisible) { if (cursorVisible) {
return; return;
} }
@@ -54,22 +72,7 @@ const HomeOnSale = ({ order, scrollTopBody, ...rest }) => {
handleStopScrolling(); handleStopScrolling();
} }
}, []); }, []);
const renderItem = useCallback(
({ index, ...rest }) => {
const itemData = homeOnSaleInfos[index];
return (
<HomeOnSaleItem
{...rest}
key={index}
homeOnSaleInfos={homeOnSaleInfos}
itemData={itemData}
onFocus={() => handleFocus(index)}
/>
);
},
[homeOnSaleInfos]
);
const orderStyle = useMemo(() => ({ order: order }), [order]); const orderStyle = useMemo(() => ({ order: order }), [order]);
return ( return (
@@ -81,17 +84,6 @@ const HomeOnSale = ({ order, scrollTopBody, ...rest }) => {
data-title-index="homeOnSale" data-title-index="homeOnSale"
/> />
<div className={css.onSaleItem}> <div className={css.onSaleItem}>
{/* {homeOnSaleInfos && homeOnSaleInfos.length > 0 && (
<TVirtualGridList
className={css.grid}
dataSize={homeOnSaleInfos.length}
direction="horizontal"
renderItem={renderItem}
itemHeight={300}
itemWidth={630}
spacing={18}
/>
)} */}
<TScroller <TScroller
cbScrollTo={getScrollTo} cbScrollTo={getScrollTo}
direction="horizontal" direction="horizontal"

View File

@@ -17,7 +17,7 @@ import useScrollReset from "../../../hooks/useScrollReset";
import useScrollTo from "../../../hooks/useScrollTo"; import useScrollTo from "../../../hooks/useScrollTo";
import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance"; import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance";
import { panel_names } from "../../../utils/Config"; import { panel_names } from "../../../utils/Config";
import { $L } from "../../../utils/helperMethods"; import { $L, scaleW } from "../../../utils/helperMethods";
import css from "../PopularShow/PopularShow.module.less"; import css from "../PopularShow/PopularShow.module.less";
const SpottableComponent = Spottable("div"); const SpottableComponent = Spottable("div");
@@ -93,13 +93,10 @@ const PopularShow = ({ homeChk = true, order, scrollTopBody, ...rest }) => {
const orderStyle = useMemo(() => ({ order: order }), [order]); const orderStyle = useMemo(() => ({ order: order }), [order]);
const handleScrollRight = (e) => { const handleScrollRight = (e) => {
const container = e.currentTarget?.parentNode; const container = e.currentTarget?.parentNode;
let gap = 18; let gap = scaleW(18);
let itemWidth = 546; let itemWidth = scaleW(546);
let moreItemWidth = 198; let moreItemWidth = scaleW(198);
let containerBoxWidth = 1740; let containerBoxWidth = scaleW(1740);
// const maxVisibleCount = Math.floor((containerWidth - padding) / (itemWidth + gap));
// item의 배열 길이가 5이상 일때 작동해야 함, if maxVisibleCount보다 아이템의 갯수가 작다면 return
let itemLength = topInfos?.length; let itemLength = topInfos?.length;
const x = const x =

View File

@@ -22,6 +22,7 @@ import useScrollReset from "../../../hooks/useScrollReset";
import useScrollTo from "../../../hooks/useScrollTo"; import useScrollTo from "../../../hooks/useScrollTo";
import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance"; import useScrollTopByDistance from "../../../hooks/useScrollTopByDistance";
import { panel_names } from "../../../utils/Config"; import { panel_names } from "../../../utils/Config";
import { scaleW } from "../../../utils/helperMethods";
import CategoryNav from "../../HomePanel/SubCategory/CategoryNav/CategoryNav"; import CategoryNav from "../../HomePanel/SubCategory/CategoryNav/CategoryNav";
import css from "../../HomePanel/SubCategory/SubCategory.module.less"; import css from "../../HomePanel/SubCategory/SubCategory.module.less";
@@ -175,13 +176,10 @@ const SubCategory = ({ order, scrollTopBody, catCd }) => {
const handleScrollRight = (e) => { const handleScrollRight = (e) => {
const container = e.currentTarget?.parentNode; const container = e.currentTarget?.parentNode;
let gap = 18; let gap = scaleW(18);
let itemWidth = 324; let itemWidth = scaleW(324);
let moreItemWidth = 198; let moreItemWidth = scaleW(198);
let containerBoxWidth = 1740; let containerBoxWidth = scaleW(1740);
// const maxVisibleCount = Math.floor((containerWidth - padding) / (itemWidth + gap));
// item의 배열 길이가 5이상 일때 작동해야 함, if maxVisibleCount보다 아이템의 갯수가 작다면 return
let itemLength = categoryItemInfos?.length; let itemLength = categoryItemInfos?.length;
const x = const x =