Skip to content

[Feature/#66] 통합 대시보드 공용 카드 UI 컴포넌트 추출 및 레이아웃 구현 - #72

Merged
Seojegyeong merged 3 commits into
developfrom
feature/#66
Mar 2, 2026
Merged

[Feature/#66] 통합 대시보드 공용 카드 UI 컴포넌트 추출 및 레이아웃 구현#72
Seojegyeong merged 3 commits into
developfrom
feature/#66

Conversation

@Seojegyeong

@Seojegyeong Seojegyeong commented Mar 1, 2026

Copy link
Copy Markdown
Collaborator

🚨 관련 이슈

#66

✨ 변경사항

  • 🐞 BugFix Something isn't working
  • 💻 CrossBrowsing Browser compatibility
  • 🌏 Deploy Deploy
  • 🎨 Design Markup & styling
  • 📃 Docs Documentation writing and editing (README.md, etc.)
  • ✨ Feature Feature
  • 🔨 Refactor Code refactoring
  • ⚙️ Setting Development environment setup
  • ✅ Test Test related (storybook, jest, etc.)

✏️ 작업 내용

공용 컴포넌트 추출

  • 대시보드 전반에서 재사용되는 Card, StatCard 컴포넌트 분리
  • 타입 분리 및 임시 mock 데이터 분리
  • 반응형 레이아웃 구현
  • Card, StatCard 각 variant별 Storybook 스토리 작성

😅 미완성 작업

통합 대시보드는 컴포넌트 구조 확인을 위해 레이아웃까지만 구성했습니다.
차트, AI 요약 버튼 등 내부 콘텐츠 구현은 추후 이슈에서 진행할 예정입니다.

📢 논의 사항 및 참고 사항

N/A

💬 리뷰어 가이드 (P-Rules)
P1: 필수 반영 (Critical) - 버그 가능성, 컨벤션 위반. 해결 전 머지 불가.
P2: 적극 권장 (Recommended) - 더 나은 대안 제시. 가급적 반영 권장.
P3: 제안 (Suggestion) - 아이디어 공유. 반영 여부는 드라이버 자율.
P4: 단순 확인/칭찬 (Nit) - 사소한 오타, 칭찬 등 피드백.

Summary by CodeRabbit

  • New Features

    • Card 컴포넌트 추가: 제목, 설명, 우측 요소 지원
    • StatCard 컴포넌트 추가: 값과 상승/하락 추세 표시
    • 대시보드 개요 페이지 업데이트: KPI 그리드 및 카드 기반 UI 완성
    • 대시보드용 개요 mock 데이터 및 타입(ITrend/IKpiMetric/IOverviewData) 추가
  • Documentation

    • Card 및 StatCard Storybook 스토리 추가: 다양한 사용 사례 시연
  • Style

    • 전역 CSS 포맷 정리(무관한 공백 추가)

@Seojegyeong
Seojegyeong requested review from YermIm and jjjsun March 1, 2026 12:49
@Seojegyeong Seojegyeong self-assigned this Mar 1, 2026
@Seojegyeong Seojegyeong added the 🎨 Html&css 마크업 & 스타일링 label Mar 1, 2026
@Seojegyeong Seojegyeong linked an issue Mar 1, 2026 that may be closed by this pull request
2 tasks
@coderabbitai

coderabbitai Bot commented Mar 1, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 075692c and bb04fe1.

📒 Files selected for processing (1)
  • src/components/common/card/StatCard.tsx
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/components/common/card/StatCard.tsx

📝 Walkthrough

Walkthrough

Card 및 StatCard UI 컴포넌트를 추가하고 Storybook 스토리와 대시보드 개요 페이지(모의 데이터 포함)를 구현하여 KPI 그리드와 카드 레이아웃을 렌더링합니다.

Changes

Cohort / File(s) Summary
Card 컴포넌트
src/components/common/card/Card.tsx, src/components/common/card/Card.stories.tsx
Card 컴포넌트 추가(선택적 헤더 및 우측 요소 지원) 및 5가지 스토리 추가. Tailwind 클래스 병합(twMerge) 사용.
StatCard 컴포넌트
src/components/common/card/StatCard.tsx, src/components/common/card/StatCard.stories.tsx
StatCard 컴포넌트 추가(제목, 값, 선택적 trend 배지) 및 4가지 스토리 추가. trend 방향에 따라 스타일/아이콘 분기.
대시보드 구현
src/pages/dashboard/overview/OverviewDashboard.tsx, src/pages/dashboard/overview/overview.mock.ts
OverviewDashboard에 KPI 그리드 및 카드 레이아웃으로 대시보드 UI 구현 및 overviewMockData 추가(4개 KPI).
타입 정의
src/types/dashboard/overview.ts
대시보드용 타입 추가: ITrend, IKpiMetric, IOverviewData.
스타일
src/index.css
포맷 수정(빈 줄 추가, 기능 변경 없음).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related issues

Suggested labels

✨ Feature

Suggested reviewers

  • jjjsun
  • YermIm

리뷰 포인트

구조 및 타입 안정성

  • StatCard와 Card의 ITrend 인터페이스 중복: src/components/common/card/StatCard.tsxsrc/types/dashboard/overview.ts에서 ITrend가 동일하게 정의되어 있습니다. 단일 소스 오브 트루(Single Source of Truth)를 위해 타입을 통합하는 것을 검토하시기 바랍니다. 예를 들어, src/types/dashboard/overview.tsITrend를 통일하고 StatCard에서 임포트하는 방식으로 개선할 수 있습니다.

접근성

  • Trend 배지의 aria-label: StatCard의 trend 배지에 방향별 aria-label("상승"/"하락")이 적절히 설정되어 있어 좋습니다. 다만 숫자 값도 함께 포함되어 있는지 확인 부탁드립니다 (현재 텍스트 콘텐츠로는 포함되어 있습니다).

성능 및 안정성

  • KpiGroup 렌더링: StatCard.stories.tsx의 KpiGroup 스토리에서 map() 함수로 여러 StatCard를 렌더링할 때, 각 요소에 고유한 key props를 설정했는지 확인 부탁드립니다. 제공된 요약에서는 명확하지 않습니다.
  • twMerge 사용: Card와 StatCard 모두 Tailwind 클래스 병합을 위해 twMerge를 사용하고 있는데, 이는 스타일 충돌을 방지하는 좋은 방식입니다.
  • Props 전파: Card 컴포넌트가 HTMLDivElement 속성을 모두 전파하도록 설계되어 있어 유연성이 좋습니다.

데이터 구조

  • overviewMockData의 일관성: 모의 데이터의 4가지 KPI 메트릭 모두 trend 객체를 포함하고 있는 것으로 보입니다. 실제 데이터에서도 모든 메트릭이 trend를 필수로 가질지, 아니면 선택사항인지 확인 필요합니다. 현재는 StatCard의 trend?: ITrend로 선택사항으로 설계되어 있으니 일관성을 맞추시기 바랍니다.
🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed PR 제목이 주요 변경 내용을 명확하게 요약하고 있습니다. 공용 카드 UI 컴포넌트 추출 및 대시보드 레이아웃 구현이라는 핵심 작업이 잘 드러나 있습니다.
Description check ✅ Passed PR 설명이 템플릿 구조를 잘 따르고 있으며, 관련 이슈, 변경 유형(Feature), 구체적인 작업 내용, 미완성 항목을 명확히 기술하고 스크린샷도 첨부되어 있습니다.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feature/#66

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

github-actions Bot commented Mar 1, 2026

Copy link
Copy Markdown

📚 Storybook 배포 완료

항목 링크
📖 Storybook https://69a147b60a56365d9e2185ef-gumyikjqst.chromatic.com/
🔍 Chromatic https://www.chromatic.com/build?appId=69a147b60a56365d9e2185ef&number=16

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
src/pages/dashboard/overview/OverviewDashboard.tsx (1)

15-17: 날짜 텍스트는 <time> 태그로 시맨틱하게 표현해 주세요.

현재는 단순 <p>라서 보조기기/파서 친화성이 떨어집니다. dateTime을 함께 주는 쪽이 접근성 측면에서 더 좋습니다.

♿ 제안 변경
-          <p className="font-caption text-text-sub mt-1">
-            데이터 기준 | 2026.01.06 09:13
-          </p>
+          <p className="font-caption text-text-sub mt-1">
+            데이터 기준 |{" "}
+            <time dateTime="2026-01-06T09:13:00+09:00">2026.01.06 09:13</time>
+          </p>

As per coding guidelines, 접근성: 시맨틱 HTML, ARIA 속성 사용 확인.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/pages/dashboard/overview/OverviewDashboard.tsx` around lines 15 - 17, 해당
날짜 텍스트가 단순 <p> 태그로 되어 있어 시맨틱성과 접근성이 떨어집니다; OverviewDashboard 컴포넌트에서 문제 되는 <p
className="font-caption text-text-sub mt-1">데이터 기준 | 2026.01.06 09:13</p>를 시맨틱한
<time> 태그로 교체하고 기존 className은 유지하되 time에 적절한 dateTime 속성(예:
"2026-01-06T09:13:00" 같은 ISO 8601 형식)을 추가해 보조기기와 파서가 정확히 해석하도록 수정하세요.
src/types/dashboard/overview.ts (1)

1-10: 공통 ITrend 타입을 단일 소스로 통합해 주세요.

src/types/dashboard/overview.tssrc/components/common/card/StatCard.tsx에 동일한 ITrend가 중복 선언되어 있어서, 한쪽 수정 시 타입 드리프트가 생길 수 있습니다. 여기서 ITrendexport하고 StatCard에서 import해서 재사용하는 편이 안전합니다.

♻️ 제안 변경
-interface ITrend {
+export interface ITrend {
   direction: "up" | "down";
   value: string;
 }
-// src/components/common/card/StatCard.tsx
-export interface ITrend {
-  direction: "up" | "down";
-  value: string;
-}
+// src/components/common/card/StatCard.tsx
+import type { ITrend } from "@/types/dashboard/overview";

As per coding guidelines, 타입 안정성: TypeScript 타입의 명확성 확인. any 사용 지양, 제네릭 활용 검토.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@src/types/dashboard/overview.ts` around lines 1 - 10, Export the shared
ITrend type from the overview file and remove the duplicate declaration in
StatCard; specifically, update interface ITrend in overview.ts to be exported
(export interface ITrend { direction: "up" | "down"; value: string; }) and then
import that ITrend into src/components/common/card/StatCard.tsx and use it in
the StatCard props/type definitions instead of the local duplicate; ensure
IKpiMetric remains using the exported ITrend where needed and delete the
redundant ITrend declaration in StatCard to avoid type drift.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@src/pages/dashboard/overview/OverviewDashboard.tsx`:
- Around line 30-35: The mobile divider condition is hardcoded to 2; update the
bottom-divider check to use the actual KPI count by replacing the literal 2 with
a computation based on kpis.length (e.g., use Math.ceil(kpis.length / 2) so
items in the first row get the bottom divider). Keep the vertical-divider logic
(index % 2 === 0) as-is but ensure the bottom divider uses kpis.length (refer to
index and kpis.length in OverviewDashboard.tsx where the two divs are rendered).

---

Nitpick comments:
In `@src/pages/dashboard/overview/OverviewDashboard.tsx`:
- Around line 15-17: 해당 날짜 텍스트가 단순 <p> 태그로 되어 있어 시맨틱성과 접근성이 떨어집니다;
OverviewDashboard 컴포넌트에서 문제 되는 <p className="font-caption text-text-sub
mt-1">데이터 기준 | 2026.01.06 09:13</p>를 시맨틱한 <time> 태그로 교체하고 기존 className은 유지하되
time에 적절한 dateTime 속성(예: "2026-01-06T09:13:00" 같은 ISO 8601 형식)을 추가해 보조기기와 파서가
정확히 해석하도록 수정하세요.

In `@src/types/dashboard/overview.ts`:
- Around line 1-10: Export the shared ITrend type from the overview file and
remove the duplicate declaration in StatCard; specifically, update interface
ITrend in overview.ts to be exported (export interface ITrend { direction: "up"
| "down"; value: string; }) and then import that ITrend into
src/components/common/card/StatCard.tsx and use it in the StatCard props/type
definitions instead of the local duplicate; ensure IKpiMetric remains using the
exported ITrend where needed and delete the redundant ITrend declaration in
StatCard to avoid type drift.

ℹ️ Review info

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 61499ce and 075692c.

⛔ Files ignored due to path filters (2)
  • src/assets/icon/dashboard/trend-down.svg is excluded by !**/*.svg and included by src/**
  • src/assets/icon/dashboard/trend-up.svg is excluded by !**/*.svg and included by src/**
📒 Files selected for processing (8)
  • src/components/common/card/Card.stories.tsx
  • src/components/common/card/Card.tsx
  • src/components/common/card/StatCard.stories.tsx
  • src/components/common/card/StatCard.tsx
  • src/index.css
  • src/pages/dashboard/overview/OverviewDashboard.tsx
  • src/pages/dashboard/overview/overview.mock.ts
  • src/types/dashboard/overview.ts

Comment thread src/pages/dashboard/overview/OverviewDashboard.tsx
Comment thread src/components/common/card/StatCard.tsx Outdated

@jjjsun jjjsun left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P4: 확인했습니다! 고생하셨어요!

Comment thread src/components/common/card/StatCard.tsx Outdated
@github-actions

github-actions Bot commented Mar 2, 2026

Copy link
Copy Markdown

📚 Storybook 배포 완료

항목 링크
📖 Storybook https://69a147b60a56365d9e2185ef-nltefllued.chromatic.com/
🔍 Chromatic https://www.chromatic.com/build?appId=69a147b60a56365d9e2185ef&number=22

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🎨 Html&css 마크업 & 스타일링

Projects

None yet

Development

Successfully merging this pull request may close these issues.

✨ [Feature] 통합 대시보드 공용 카드 UI 컴포넌트 추출

3 participants