kcg-ai-monitoring/frontend/src/design-system/sections/CardSection.tsx
htlee e0b51efc54 feat(frontend): 디자인 시스템 쇼케이스 페이지 + 신규 공통 컴포넌트
쇼케이스 (/design-system.html):
- 별도 Vite entry (System Flow 패턴 재사용, 메인 SPA 분리)
- 10개 섹션: Intro / Token / Typography / Badge / Button / Form /
  Card / Layout / Catalog (19+) / Guide
- 추적 ID 체계 (TRK-CATEGORY-SLUG):
  - hover 시 툴팁 + "ID 복사 모드"에서 클릭 시 클립보드 복사
  - URL hash 딥링크 (#trk=TRK-BADGE-critical-sm) 스크롤+하이라이트
  - 산출문서/논의에서 특정 변형 정확히 참조 가능
- Dark/Light 테마 토글로 양쪽 시각 검증

신규 공통 컴포넌트:
- Button (@shared/components/ui/button.tsx)
  - 5 variant × 3 size = 15 변형
  - primary/secondary/ghost/outline/destructive × sm/md/lg
- Input / Select / Textarea / Checkbox / Radio
  - Input · Select 공통 inputVariants 공유 (sm/md/lg × default/error/success)
- PageContainer / PageHeader / Section (shared/components/layout/)
  - PageContainer: size sm/md/lg + fullBleed (지도/풀화면 예외)
  - PageHeader: title + description + icon + demo 배지 + actions 슬롯
  - Section: Card + CardHeader + CardTitle + CardContent 단축

variants.ts 확장:
- buttonVariants / inputVariants / pageContainerVariants CVA 정의
- Button/Input/Select는 variants.ts에서 import하여 fast-refresh 경고 회피

빌드 검증 완료:
- TypeScript 타입 체크 통과
- ESLint 통과 (경고 0)
- vite build: designSystem-*.js 54KB (메인 SPA와 분리)

이 쇼케이스가 확정된 후 실제 40+ 페이지 마이그레이션 진행 예정.
2026-04-08 11:09:36 +09:00

112 lines
4.4 KiB
TypeScript

import { TrkSectionHeader, Trk } from '../lib/Trk';
import { Card, CardHeader, CardTitle, CardContent } from '@shared/components/ui/card';
import { Database, Activity, Bell } from 'lucide-react';
export function CardSectionShowcase() {
return (
<>
<TrkSectionHeader
id="TRK-SEC-card"
title="Card · Section"
description="4 variant (default/elevated/inner/transparent). CardHeader+CardTitle+CardContent 조합."
/>
{/* 4 variant */}
<h3 className="text-sm font-semibold text-heading mb-2 mt-2">Variant</h3>
<div className="ds-grid ds-grid-2">
<Trk id="TRK-CARD-default" className="ds-sample">
<label className="text-[10px] text-hint font-mono mb-2 block">variant=default</label>
<Card variant="default">
<CardHeader className="pb-2">
<CardTitle className="flex items-center gap-1.5">
<Database className="w-3.5 h-3.5 text-blue-400" />
</CardTitle>
</CardHeader>
<CardContent className="space-y-1.5">
<div className="flex justify-between text-[11px]">
<span className="text-hint">PostgreSQL</span>
<span className="text-label">v15.4 </span>
</div>
<div className="flex justify-between text-[11px]">
<span className="text-hint"></span>
<span className="text-label">8 / 20</span>
</div>
</CardContent>
</Card>
</Trk>
<Trk id="TRK-CARD-elevated" className="ds-sample">
<label className="text-[10px] text-hint font-mono mb-2 block">variant=elevated ()</label>
<Card variant="elevated">
<CardHeader className="pb-2">
<CardTitle className="flex items-center gap-1.5">
<Activity className="w-3.5 h-3.5 text-green-400" />
</CardTitle>
</CardHeader>
<CardContent className="space-y-1.5">
<div className="flex justify-between text-[11px]">
<span className="text-hint">API</span>
<span className="text-green-400"></span>
</div>
<div className="flex justify-between text-[11px]">
<span className="text-hint">Prediction</span>
<span className="text-green-400">5 </span>
</div>
</CardContent>
</Card>
</Trk>
<Trk id="TRK-CARD-inner" className="ds-sample">
<label className="text-[10px] text-hint font-mono mb-2 block">variant=inner</label>
<Card variant="inner">
<CardHeader className="pb-2">
<CardTitle className="flex items-center gap-1.5">
<Bell className="w-3.5 h-3.5 text-yellow-400" />
</CardTitle>
</CardHeader>
<CardContent>
<p className="text-[11px] text-label"> . depth.</p>
</CardContent>
</Card>
</Trk>
<Trk id="TRK-CARD-transparent" className="ds-sample">
<label className="text-[10px] text-hint font-mono mb-2 block">variant=transparent</label>
<Card variant="transparent">
<CardHeader className="pb-2">
<CardTitle> </CardTitle>
</CardHeader>
<CardContent>
<p className="text-[11px] text-label">/ ( ).</p>
</CardContent>
</Card>
</Trk>
</div>
{/* 사용 예시 */}
<h3 className="text-sm font-semibold text-heading mb-2 mt-6"> </h3>
<Trk id="TRK-CARD-usage-code" className="ds-sample">
<code className="ds-code">
{`import { Card, CardHeader, CardTitle, CardContent } from '@shared/components/ui/card';
import { Database } from 'lucide-react';
<Card variant="elevated">
<CardHeader className="pb-2">
<CardTitle className="flex items-center gap-1.5">
<Database className="w-3.5 h-3.5 text-blue-400" />
데이터베이스
</CardTitle>
</CardHeader>
<CardContent className="space-y-2">
{/* 콘텐츠 */}
</CardContent>
</Card>`}
</code>
</Trk>
</>
);
}