원클릭으로
figma
// Design-to-code workflow for Figma designs. Use when the user shares a Figma URL or asks to implement a design into the codebase.
// Design-to-code workflow for Figma designs. Use when the user shares a Figma URL or asks to implement a design into the codebase.
| name | figma |
| description | Design-to-code workflow for Figma designs. Use when the user shares a Figma URL or asks to implement a design into the codebase. |
Translate Figma designs into production-ready React components that match this repository's conventions: React 19, TypeScript, Tailwind CSS + SCSS, Storybook, and Vitest in @epam/ai-dial-ui-kit.
figma.com URLCall get_design_context with the fileKey and nodeId extracted from the URL.
URL parsing rules:
figma.com/design/:fileKey/...?node-id=:nodeId → replace - with : in nodeIdfigma.com/board/:fileKey/... → FigJam file, use get_figjam insteadIf the design context includes Code Connect snippets, prefer those — they map directly to codebase components.
Before writing any new code, check whether existing components already cover the design:
| Design need | Check first |
|---|---|
| Buttons, inputs, popups, tabs, loaders | src/components/ |
| Types and models | src/types/ and src/models/ |
| Reusable behavior | src/hooks/ and src/utils/ |
| Icons and icon wrappers | src/assets/icons/ and src/components/Icon/ |
Search the codebase before building from scratch:
rg "Dial|ComponentName" src/components
src/components/<ComponentName>/Dial (for example, DialButton)mergeClasses from src/utils/merge-classes when class composition is non-trivialAdd or update Component.stories.tsx. Every new prop and every Figma variant must have its own named story.
Story checklist:
Info, Success, Warning, Error, Loading)WithTitle, Closable)AllVariants render story showing every variant side-by-sideargTypes with control and descriptionoptions array in argTypesPattern:
export const MyVariant: Story = {
args: { variant: MyVariantEnum.Value, message: 'Example text' },
};
export const AllVariants: Story = {
render: () => (
<div className="flex flex-col gap-4 p-6">
<DialComponent variant={MyVariantEnum.A} message="A" />
<DialComponent variant={MyVariantEnum.B} message="B" />
</div>
),
};
Add or update Component.spec.tsx. Cover every new prop and new variant.
Test checklist:
getByRole), fall back to text only when no role appliesPattern:
test('Should render title above message when title is provided', () => {
render(<DialComponent title="Heading" message="Body" />);
const title = screen.getByText('Heading');
const message = screen.getByText('Body');
expect(title).toHaveClass('font-semibold');
expect(title.compareDocumentPosition(message)).toBe(
Node.DOCUMENT_POSITION_FOLLOWING,
);
});
test('Should render spinner for Loading variant', () => {
render(<DialComponent variant="loading" message="Wait…" />);
expect(screen.getByRole('status')).toBeInTheDocument();
});
src/index.tsnpm run typechecknpm run lintnpm run testWhen adding a new public component from Figma, include all of the following:
src/components/<Name>/<Name>.tsxsrc/components/<Name>/<Name>.stories.tsxsrc/components/<Name>/<Name>.spec.tsxsrc/index.ts export updates (export and export type as needed)