import { useEffect, useRef, useState } from "react" import type { Meta, StoryObj } from "@storybook/react-vite" import { typographyProperties, typographyReferences } from "./reference-data" import { ReferencePage, ReferenceSection, useResolvedProperties } from "./reference" type TypographyReference = (typeof typographyReferences)[number] const weights = [ { property: "--hm-input-font-weight", label: "Regular" }, { property: "--hm-font-weight-medium", label: "Medium" }, { property: "--hm-font-weight-bold", label: "Bold" }, ] // Left table: text styles. Right table: form controls. Together they cover every entry in typographyReferences. const textLabels = ["Page Header · title", "Card · title", "Page Header · description", "Label"] const textRows = typographyReferences.filter(item => textLabels.includes(item.label)) const controlRows = typographyReferences.filter(item => !textLabels.includes(item.label)) function SpecimenRow({ label, size, line, weight }: TypographyReference & { weight?: string }) { const ref = useRef(null) const [metrics, setMetrics] = useState({ main: "", spacing: "" }) useEffect(() => { let mounted = true void document.fonts.ready.then(() => { if (!mounted || !ref.current) return const style = getComputedStyle(ref.current) setMetrics({ main: `${style.fontSize} / ${style.lineHeight} / ${style.fontWeight}`, spacing: `letter-spacing: ${style.letterSpacing}` }) }) return () => { mounted = false } }, []) return {label}
한맥 Hanmac 0123
{metrics.main}{metrics.spacing} } function SpecimenTable({ rows }: { rows: readonly TypographyReference[] }) { return {rows.map(item => )}
ComponentSampleSize / Line / Weight
} function TypographyReferencePage() { const values = useResolvedProperties(typographyProperties) return

Noto Sans KR → 맑은 고딕 → 시스템 sans-serif--hm-font-family-base: {values["--hm-font-family-base"]}

{weights.map(({ property, label }) =>

{label} {values[property]}

한맥 Hanmac 0123

{property}
)}
} // The sidebar name is "폰트"; `id` keeps the existing Story ID (foundation-typography--all) stable. const meta = { title: "Foundation/폰트", id: "foundation-typography", parameters: { layout: "fullscreen" } } satisfies Meta export default meta export const All: StoryObj = { name: "폰트", render: () => }