diff --git a/frontend/src/components/shared/SummaryStatCards/SummaryStatCards.css b/frontend/src/components/shared/SummaryStatCards/SummaryStatCards.css index 3f0453f..04b9388 100644 --- a/frontend/src/components/shared/SummaryStatCards/SummaryStatCards.css +++ b/frontend/src/components/shared/SummaryStatCards/SummaryStatCards.css @@ -1,4 +1,8 @@ .summary-stat-cards { + --summary-stat-columns: 4; + display: grid; + grid-template-columns: 1fr; + gap: 16px; flex-shrink: 0; min-width: 0; } @@ -36,3 +40,15 @@ align-items: center; line-height: 1; } + +@media (min-width: 576px) { + .summary-stat-cards { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } +} + +@media (min-width: 1200px) { + .summary-stat-cards { + grid-template-columns: repeat(var(--summary-stat-columns), minmax(0, 1fr)); + } +} diff --git a/frontend/src/components/shared/SummaryStatCards/index.tsx b/frontend/src/components/shared/SummaryStatCards/index.tsx index b1c80af..b836636 100644 --- a/frontend/src/components/shared/SummaryStatCards/index.tsx +++ b/frontend/src/components/shared/SummaryStatCards/index.tsx @@ -1,5 +1,5 @@ import type { CSSProperties, ReactNode } from "react"; -import { Card, Col, Row, Statistic } from "antd"; +import { Card, Statistic } from "antd"; import "./SummaryStatCards.css"; export interface SummaryStatCardItem { @@ -16,26 +16,28 @@ interface SummaryStatCardsProps { } export default function SummaryStatCards({ items, ariaLabel }: SummaryStatCardsProps) { + const columns = Math.max(items.length, 1); + return ( -
- - {items.map((item) => ( - - - {item.label}} - value={item.value} - valueStyle={{ color: item.color, fontWeight: 700 } as CSSProperties} - prefix={ - - {item.icon} - - } - /> - - - ))} - +
+ {items.map((item) => ( + + {item.label}} + value={item.value} + valueStyle={{ color: item.color, fontWeight: 700 } as CSSProperties} + prefix={ + + {item.icon} + + } + /> + + ))}
); }