Files
sam-react-prod/src/components/organisms/StatCards.tsx
유병철 7f39f3066f feat(WEB): 회계/설정/카드 관리 페이지 대규모 기능 추가 및 리팩토링
- 일반전표입력, 상품권관리, 세금계산서 발행/조회 신규 페이지 추가
- 바로빌 연동 설정 페이지 추가
- 카드관리/계좌관리 리스트 UniversalListPage 공통 구조로 전환
- 카드거래조회/은행거래조회 리팩토링 (모달 분리, 액션 확장)
- 계좌 상세 폼(AccountDetailForm) 신규 구현
- 카드 상세(CardDetail) 신규 구현 + CardNumberInput 적용
- DateRangeSelector, StatCards, IntegratedListTemplateV2 공통 컴포넌트 개선
- 레거시 파일 정리 (CardManagementUnified, cardConfig, _legacy 등)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-15 23:18:45 +09:00

77 lines
2.3 KiB
TypeScript

"use client";
import { Card, CardContent } from "@/components/ui/card";
import { LucideIcon } from "lucide-react";
interface StatCardData {
label: string;
sublabel?: string;
value: string | number;
icon?: LucideIcon;
iconColor?: string;
trend?: {
value: string;
isPositive: boolean;
};
onClick?: () => void;
isActive?: boolean;
}
interface StatCardsProps {
stats: StatCardData[];
}
export function StatCards({ stats }: StatCardsProps) {
const count = stats.length;
const gridClass =
count >= 5
? 'grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 gap-2'
: 'grid grid-cols-2 sm:grid-cols-3 md:grid-cols-4 gap-2';
return (
<div className={gridClass}>
{stats.map((stat, index) => {
const Icon = stat.icon;
const isClickable = !!stat.onClick;
return (
<Card
key={index}
className={`flex-1 min-w-0 transition-colors ${
isClickable ? 'cursor-pointer hover:border-primary/50' : ''
} ${
stat.isActive ? 'border-primary bg-primary/5' : ''
}`}
onClick={stat.onClick}
>
<CardContent className="p-2 md:p-3">
<div className="flex items-center justify-between">
<div className="flex-1 min-w-0">
<p className="text-[10px] md:text-xs text-muted-foreground mb-0.5 uppercase tracking-wide truncate">
{stat.label}
{stat.sublabel && (
<span className="ml-2 normal-case tracking-normal">{stat.sublabel}</span>
)}
</p>
<p className="font-bold text-base md:text-lg truncate">
{stat.value}
</p>
{stat.trend && (
<p className={`text-[9px] md:text-[10px] mt-0.5 font-medium ${stat.trend.isPositive ? 'text-green-600' : 'text-red-600'}`}>
{stat.trend.value}
</p>
)}
</div>
{Icon && (
<Icon
className={`w-6 h-6 md:w-8 md:h-8 opacity-15 flex-shrink-0 ${stat.iconColor || 'text-blue-600'}`}
/>
)}
</div>
</CardContent>
</Card>
);
})}
</div>
);
}