[더보기 버튼] 관련 수정건.

This commit is contained in:
junghoon86.park
2024-05-07 14:28:53 +09:00
parent 78a291900f
commit a5ed47ea24
3 changed files with 69 additions and 2 deletions

View File

@@ -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>