Skip to content

Commit bcab1e1

Browse files
committed
fix(doc-home): align card grid columns
1 parent 1993248 commit bcab1e1

1 file changed

Lines changed: 13 additions & 2 deletions

File tree

src/components/MDXComponents/DocHome.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ export function DocHomeCardContainer(props: any) {
341341
sm: "grid",
342342
},
343343
flexDirection: "column",
344-
gridTemplateColumns: "repeat(auto-fit, minmax(224px, 30%))",
344+
gridTemplateColumns: {
345+
sm: "repeat(2, minmax(0, 1fr))",
346+
lg: "repeat(3, minmax(0, 1fr))",
347+
},
345348
gap: "1.25rem",
346349
justifyContent: "start",
347350

@@ -363,6 +366,7 @@ interface DocHomeCardProps {
363366
icon: string;
364367
label: string;
365368
colSpan?: 1 | 2 | 3;
369+
colspan?: 1 | 2 | 3;
366370
actionBtnLabel?: string;
367371
ctaGraphic?: string;
368372
}
@@ -374,9 +378,11 @@ export function DocHomeCard(props: React.PropsWithChildren<DocHomeCardProps>) {
374378
icon = "global-tidb-product",
375379
label,
376380
colSpan,
381+
colspan,
377382
actionBtnLabel,
378383
ctaGraphic,
379384
} = props;
385+
const cardColSpan = colSpan ?? colspan;
380386

381387
return (
382388
<Box
@@ -391,7 +397,12 @@ export function DocHomeCard(props: React.PropsWithChildren<DocHomeCardProps>) {
391397
padding: "24px",
392398
transition: ".5s",
393399
border: `1px solid ${theme.palette.carbon[400]}`,
394-
gridColumn: colSpan ? `span ${colSpan}` : undefined,
400+
gridColumn: cardColSpan
401+
? {
402+
sm: `span ${Math.min(cardColSpan, 2)}`,
403+
lg: `span ${cardColSpan}`,
404+
}
405+
: undefined,
395406

396407
"&:hover": {
397408
background:

0 commit comments

Comments
 (0)