"use client";
import { useState, type ReactNode } from "react";
import { FoxButton } from "../core/components/fox-button";
import { FoxTextButton } from "../core/components/fox-text-button";
import { FoxLinkButton } from "../core/components/fox-link-button";
import { FoxIconButton } from "../core/components/fox-icon-button";
export interface ComponentExample {
/** 해시 링크에 쓰이는 kebab-case 식별자. */
id: string;
name: string;
description?: string;
/** 눈으로 비교해야 하는 조합을 빠짐없이 넣는다 — 예제가 곧 회귀 확인 수단이다. */
variants: { label: string; node: ReactNode }[];
}
// 자리 확인용 도형. `currentColor`로 그려야 계열별 색이 입혀진다.
function DemoIcon() {
return (
);
}
function DemoStar() {
return (
);
}
// overlay 계열은 어두운 반투명 배경이라 밝은 바탕 위에서는 대비를 볼 수 없다.
function OnPhoto({ children }: { children: ReactNode }) {
return (
{children}
);
}
// active는 호출부가 소유하므로 켜고 끄는 걸 보려면 예제가 상태를 들고 있어야 한다.
function IconToggleDemo() {
const [on, setOn] = useState(false);
return (
<>
}
active={on}
onAction={() => setOn((prev) => !prev)}
/>
}
active={on}
onAction={() => setOn((prev) => !prev)}
/>
}
active={on}
onAction={() => setOn((prev) => !prev)}
/>
>
);
}
/** 컴포넌트를 만들 때마다 항목 하나를 추가한다 — 다른 파일은 고치지 않는다. */
export const COMPONENT_EXAMPLES: ComponentExample[] = [
{
id: "fox-button",
name: "FoxButton",
description:
"Figma 시안(관리자페이지 node 390:439)을 토큰만으로 옮겼습니다. 너비는 내용에 따라 가변이고 높이만 고정입니다. hover·pressed는 마우스를 올리거나 눌러 확인하세요. error 계열은 시안 미정이라 비어 있습니다.",
variants: [
{
label: "계열 (type) — hover·pressed 확인 가능",
node: (
<>
>
),
},
{
label: "크기 (size)",
node: (
<>
>
),
},
{
label: "아이콘",
node: (
<>
} />
} />
} trailingIcon={} />
>
),
},
{
label: "상태 — disabled / loading (둘 다 클릭이 막힌다)",
node: (
<>
undefined} />
} />
>
),
},
{
label: "fullWidth",
node: ,
},
{
label: "htmlType — 폼 안에서의 역할",
node: (
<>
>
),
},
{
label: "hidden — 렌더되지 않는다(아래는 비어 있는 것이 정상)",
node: ,
},
],
},
{
id: "fox-text-button",
name: "FoxTextButton",
description:
"Figma 시안(btn-txt, 컴포넌트 세트 106:2468)을 토큰만으로 옮겼습니다. 높이를 고정하지 않고 패딩과 line-height로만 크기를 잡습니다. lg만 상하 패딩과 간격이 한 단계 넓습니다.",
variants: [
{
label: "계열 (type) — primary는 굵기가 한 단계 더 굵다",
node: (
<>
>
),
},
{
label: "크기 (size)",
node: (
<>
>
),
},
{
label: "아이콘",
node: (
<>
} />
} />
}
trailingIcon={}
/>
>
),
},
{
label: "상태 — disabled",
node: (
<>
undefined} />
>
),
},
],
},
{
id: "fox-link-button",
name: "FoxLinkButton",
description:
"Figma 시안(btn-lnk, 컴포넌트 세트 107:207)을 토큰만으로 옮겼습니다. href를 주면 , 없으면