diff --git a/components/markets/MarketScroll.tsx b/components/markets/MarketScroll.tsx index cc318a63c..180c2b4d5 100644 --- a/components/markets/MarketScroll.tsx +++ b/components/markets/MarketScroll.tsx @@ -37,18 +37,13 @@ const MarketScroll = ({ markets.map((m) => m.marketId), ); - const gap = 28; + const gap = 16; //calculate cards shown and width based on container width const cardsShown = windowWidth < BREAKPOINTS.md ? 1 : windowWidth < BREAKPOINTS.lg ? 2 : 3; - const cardWidth = - windowWidth < BREAKPOINTS.md - ? containerWidth - : windowWidth < BREAKPOINTS.lg - ? (containerWidth - gap) / cardsShown - : (containerWidth - gap * 2) / cardsShown; + const cardWidth = (containerWidth - gap * (cardsShown - 1)) / cardsShown; const handleRightClick = () => { setPageIndex(pageIndex + 1); @@ -104,7 +99,7 @@ const MarketScroll = ({ transform: `translateX(${ windowWidth < BREAKPOINTS.sm ? 0 - : -(showRange[0] * (cardWidth + gap)) + : -(showRange[0] * cardWidth + pageIndex * gap) }px)`, }} className={`flex ${ diff --git a/components/markets/market-card/index.tsx b/components/markets/market-card/index.tsx index 1cb8f6318..ad8902b55 100644 --- a/components/markets/market-card/index.tsx +++ b/components/markets/market-card/index.tsx @@ -225,7 +225,7 @@ export const MarketCard = ({