[더보기 버튼] 관련 수정건.
This commit is contained in:
@@ -91,7 +91,27 @@ const BestSeller = ({ order, scrollTopBody, panelInfo }) => {
|
||||
);
|
||||
|
||||
const orderStyle = useMemo(() => ({ order: order }), [order]);
|
||||
const handleScrollRight = (e) => {
|
||||
const container = e.currentTarget?.parentNode;
|
||||
|
||||
let gap = 18;
|
||||
let itemWidth = 324;
|
||||
let moreItemWidth = 198;
|
||||
let containerBoxWidth = 1740;
|
||||
|
||||
// const maxVisibleCount = Math.floor((containerWidth - padding) / (itemWidth + gap));
|
||||
// item의 배열 길이가 5이상 일때 작동해야 함, if maxVisibleCount보다 아이템의 갯수가 작다면 return
|
||||
let itemLength = bestSellerDatas?.length;
|
||||
|
||||
const x =
|
||||
(itemWidth + gap) * itemLength +
|
||||
(moreItemWidth + gap) -
|
||||
containerBoxWidth;
|
||||
|
||||
setTimeout(() => {
|
||||
scrollLeft({ x, animate: true });
|
||||
});
|
||||
};
|
||||
return (
|
||||
<Container className={css.bestSellerWrap} style={orderStyle}>
|
||||
<SectionTitle
|
||||
@@ -140,6 +160,7 @@ const BestSeller = ({ order, scrollTopBody, panelInfo }) => {
|
||||
<SpottableComponent
|
||||
className={css.addItem}
|
||||
onClick={handleMoreCardClick}
|
||||
onFocus={handleScrollRight}
|
||||
></SpottableComponent>
|
||||
)}
|
||||
</TScroller>
|
||||
|
||||
Reference in New Issue
Block a user