Initial commit: HMDesignSystem baseline
This commit is contained in:
commit
b6a0a61103
486 files changed
+68432
No files matched your search
@@ -0,0 +1,56 @@
|
||||
import type { CSSProperties } from "react"
|
||||
import {
|
||||
countDashboardFilter,
|
||||
dashboardFilterDefinitions,
|
||||
dashboardFilterIds,
|
||||
dashboardStatusDefinitions,
|
||||
matchesDashboardFilter,
|
||||
type DashboardFilterId,
|
||||
type DashboardStatusId,
|
||||
} from "@hm-design/ui"
|
||||
|
||||
// Story-local work data. User account states in sample-users.ts are a different domain.
|
||||
// Variant C treats issue as an independent flag: a held task can also have an issue.
|
||||
export type DashboardWorkStatus = DashboardStatusId
|
||||
export type DashboardWorkFilter = DashboardFilterId
|
||||
export type DashboardWork = {
|
||||
id: string
|
||||
name: string
|
||||
department: string
|
||||
status: DashboardWorkStatus
|
||||
issue?: boolean
|
||||
createdAt: string
|
||||
}
|
||||
|
||||
export const dashboardWorkStatus = {
|
||||
all: { label: dashboardFilterDefinitions.all.label, color: "var(--hm-sem-palette-yellow-accent)" },
|
||||
active: { label: dashboardStatusDefinitions.active.label, color: "var(--dashboard-work-progress)" },
|
||||
hold: { label: dashboardStatusDefinitions.hold.label, color: "var(--dashboard-work-hold)" },
|
||||
done: { label: dashboardStatusDefinitions.done.label, color: "var(--hm-dashboard-status-done)" },
|
||||
issue: { label: dashboardFilterDefinitions.issue.label, color: "var(--dashboard-work-issue)" },
|
||||
} satisfies Record<DashboardWorkFilter, { label: string; color: string }>
|
||||
|
||||
export const dashboardWorkFilters = dashboardFilterIds
|
||||
|
||||
// Both filter counts and the existing HM Badge consume this component mapping.
|
||||
export const dashboardWorkStyle = (status: DashboardWorkFilter): CSSProperties =>
|
||||
({ "--dashboard-status-color": dashboardWorkStatus[status].color } as CSSProperties)
|
||||
|
||||
export const matchesDashboardWorkStatus = (work: DashboardWork, status: DashboardWorkFilter) =>
|
||||
matchesDashboardFilter(work, status)
|
||||
|
||||
export const countDashboardWorkFilter = (works: readonly DashboardWork[], filter: DashboardWorkFilter) => countDashboardFilter(works, filter)
|
||||
|
||||
const names = ["대시보드 화면 검토", "업무 자료 정리", "현장 점검 보고", "설계 의견 반영", "품질 검토", "일정 확인", "도면 검수", "안전 점검", "회의록 작성", "최종 보고서 검토"]
|
||||
const departments = ["설계팀", "시공팀", "안전관리팀", "품질팀", "경영지원팀"]
|
||||
const statuses: DashboardWorkStatus[] = ["hold", "active", "done", "active"]
|
||||
|
||||
// Keep pagination coverage without reinterpreting any shared user fixture or public enum.
|
||||
export const dashboardWorks: DashboardWork[] = Array.from({ length: 47 }, (_, i) => ({
|
||||
id: `T-${String(i + 1).padStart(3, "0")}`,
|
||||
name: `${names[i % names.length]}${i >= names.length ? ` ${Math.floor(i / names.length) + 1}` : ""}`,
|
||||
department: departments[(i * 3) % departments.length],
|
||||
status: statuses[i % statuses.length],
|
||||
issue: i % 11 === 0,
|
||||
createdAt: new Date(2026, 9, 1 + (i % 28)).toISOString(),
|
||||
}))
|
||||
Reference in new issue
Block a user