Files
Aislo/ui_template/ui_template_empty.ts
T
eomsangdonandClaude Opus 5.5 7e584c1e7b feat(ui-kit): 묶음 부품 열 — 카드 · 접이 카드 · 빈 상태 · 알림 · 띠 알림 · 숫자 카드 · 값 목록 · 진행 막대 · 작은 그래프 · 범례 (PLAN 552-3)
- 새 부품 파일: ui_template_card · empty · banner · stat · kv · toast · flow_legend(.ts) · 진행 막대 · 막대 · 원 그래프 덧붙임
- createCard · showToast · 로딩 가림막은 부품 파일로 옮기고 본체(ui_template_elements)가 다시 내보냄 — 부름 꼴 그대로
- 대시보드 emptyState = 빈 상태 부품을 씀(한 벌) · 선 카드 그림자 0 · 가림막 옛 보라 → --color-scrim
- 부품 모음 화면 견본(밝음 · 어두움 · 상태) · 지킴 시험 test_552_3_* 열
- 전후 촬영: B01 여덟 화면 자리 · 화소 같음(실시간 CPU 값만 다름) · A01 · B08 카드 그림자만 다름

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-26 21:28:29 +09:00

45 lines
2.2 KiB
TypeScript

/* =============================================================================
* ui_template_empty.ts
* 부품 「빈 상태」(552-3 · 목록 21) — 보일 것이 없을 때 그 자리에 놓는 안내.
* 꼴 = 큰 꼴(카드 · 선 아이콘 원 · 한 줄 · 보조 글 · 주 단추 · 「사용법 보기」) · 작은 꼴(`small` — 패널 안 한 줄 · 테두리 없음)
* 크기 = 아이콘 원 56 · 아이콘 32 · 글 14 / 보조 12
* 상태 = 기본만
* 쓰는 법 = `createEmpty({ icon: "folder", text: "아직 프로젝트가 없음", action: createButton(…) })` · `createEmpty({ text: "고른 측점 없음", small: true })`
* 대신하는 옛 변종 = B01 `emptyState`(`.b01-pg-empty`) · `.ui-general-block__empty` · `.ui-chart__empty` · `.b01-proj-empty` · 페이지마다 `__empty` 약 25 벌
* ========================================================================== */
import { el } from "./ui_template_elements_base";
import { icon, type IconName } from "./ui_template_icons";
import "./ui_template_empty.css";
export interface EmptyOptions {
/** 선 아이콘 이름 또는 만든 아이콘 요소 — 작은 꼴은 안 씀 */
icon?: IconName | HTMLElement;
text: string;
hint?: string;
/** 주 단추 */
action?: HTMLElement;
/** 「사용법 보기」 링크 — 누르면 */
onGuide?: () => void;
/** 패널 안 한 줄 */
small?: boolean;
}
export function createEmpty(opts: EmptyOptions): HTMLElement {
const box = el("div", { className: `ui-empty${opts.small ? " ui-empty--small" : ""}` });
if (opts.icon && !opts.small) {
const glyph = typeof opts.icon === "string" ? icon(opts.icon, 32) : opts.icon;
box.append(el("div", { className: "ui-empty__icon", children: [glyph] }));
}
box.append(el("p", { className: "ui-empty__text", text: opts.text }));
if (opts.hint) box.append(el("p", { className: "ui-empty__hint", text: opts.hint }));
if (opts.action) box.append(opts.action);
if (opts.onGuide) {
const link = el("button", { className: "ui-empty__link", text: "사용법 보기" });
link.type = "button";
link.addEventListener("click", opts.onGuide);
box.append(link);
}
return box;
}