- 라우팅 react-router v7, 서버상태 TanStack Query - orval 자동 생성 API 클라이언트(src/api/generated) - 견적/상품/협력사/견적설정 페이지, shadcn UI, 토큰(tokens.css) - 실행: 루트 docker compose (front :3001), README 그에 맞게 정리 - AI Studio 스캐폴드 잔재 제거(metadata.json, 중복 DESIGN_TOKENS.md), 타이틀 NegoData, vite.config 죽은코드 제거 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
62 lines
2.2 KiB
TypeScript
62 lines
2.2 KiB
TypeScript
import * as React from "react"
|
|
import { cva, type VariantProps } from "class-variance-authority"
|
|
|
|
import { cn } from "@/lib/utils"
|
|
|
|
// 디자인시스템 텍스트 토큰. 페이지마다 text-2xl/font-bold/tracking-...를
|
|
// 직접 박지 말고 variant로 통일한다. 실제로 코드에 흩어져 있던 조합을 그대로 토큰화함.
|
|
const typographyVariants = cva("", {
|
|
variants: {
|
|
variant: {
|
|
h1: "text-4xl font-bold tracking-tight text-foreground",
|
|
h2: "text-2xl font-bold tracking-tight text-foreground",
|
|
h3: "text-xl font-bold text-foreground",
|
|
h4: "text-lg font-semibold text-foreground",
|
|
body: "text-base text-foreground",
|
|
small: "text-sm text-foreground",
|
|
muted: "text-sm text-muted-foreground leading-relaxed",
|
|
// 폼 라벨: 대문자 트래킹 (login의 label 패턴)
|
|
label: "text-xs font-semibold uppercase tracking-wider text-foreground",
|
|
// 모노 캡션: 콘솔/메타 텍스트 (login 서브타이틀, 푸터 등)
|
|
mono: "text-xs font-mono uppercase tracking-wider text-muted-foreground",
|
|
// 사이드바/헤더 등 chrome 메타텍스트: type scale 최소(text-xs=12px)보다 작은 11px 캡션
|
|
caption: "text-[11px] text-muted-foreground leading-normal",
|
|
},
|
|
},
|
|
defaultVariants: { variant: "body" },
|
|
})
|
|
|
|
const defaultTag: Record<NonNullable<VariantProps<typeof typographyVariants>["variant"]>, React.ElementType> = {
|
|
h1: "h1",
|
|
h2: "h2",
|
|
h3: "h3",
|
|
h4: "h4",
|
|
body: "p",
|
|
small: "p",
|
|
muted: "p",
|
|
label: "span",
|
|
mono: "span",
|
|
caption: "span",
|
|
}
|
|
|
|
type TypographyProps = React.HTMLAttributes<HTMLElement> &
|
|
VariantProps<typeof typographyVariants> & {
|
|
/** 의미상 태그를 강제로 바꾸고 싶을 때 (예: label variant를 <label>로) */
|
|
as?: React.ElementType
|
|
/** as="label"일 때 폼 연결용 (label 전용 속성이라 따로 허용) */
|
|
htmlFor?: string
|
|
}
|
|
|
|
function Typography({ className, variant, as, ...props }: TypographyProps) {
|
|
const Comp = as ?? defaultTag[variant ?? "body"]
|
|
return (
|
|
<Comp
|
|
data-slot="typography"
|
|
className={cn(typographyVariants({ variant }), className)}
|
|
{...props}
|
|
/>
|
|
)
|
|
}
|
|
|
|
export { Typography, typographyVariants }
|