Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Market scroll gap fix #1809

Merged
merged 4 commits into from
Sep 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 3 additions & 8 deletions components/markets/MarketScroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -104,7 +99,7 @@ const MarketScroll = ({
transform: `translateX(${
windowWidth < BREAKPOINTS.sm
? 0
: -(showRange[0] * (cardWidth + gap))
: -(showRange[0] * cardWidth + pageIndex * gap)
}px)`,
}}
className={`flex ${
Expand Down
2 changes: 1 addition & 1 deletion components/markets/market-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ export const MarketCard = ({
<MarketCardContext.Provider value={{ baseAsset }}>
<div
data-testid={`marketCard-${marketId}`}
className={`group flex flex-col min-w-full md:min-w-[calc(50%-14px)] lg:min-w-[calc(100%/3-9.67px)]
className={`group flex flex-col min-w-full md:min-w-[calc(50%-8px)] lg:min-w-[calc(100%/3-9.67px)]
rounded-[10px] p-5 relative bg-white ztg-transition md:hover:scale-[1.035] ${className}`}
>
<Link
Expand Down