Implementing figma designs

From tmcfarlane/oh-my-cursor · View interactive version

Implementing figma designs is an AI agent skill from the GitHub repository tmcfarlane/oh-my-cursor. Implements Figma designs 1:1 using OneKey component library (还原设计稿).

How to use this skill

Skill file

Implementing Figma Designs

This skill helps you implement Figma designs 1:1 using the OneKey component library.

Core Principles

Focus on UI First, Data Later

When implementing Figma designs, prioritize pixel-perfect UI over data integration:

  1. Use mock data - Hardcode data that matches the design exactly
  2. Skip i18n - Use plain strings directly from the design, no intl.formatMessage
  3. Skip API calls - No need to fetch real data at this stage
  4. Match the design - Focus on visual accuracy, spacing, colors, and layout

What NOT to do

What TO do

Component Lookup (On-Demand)

When you need to use a component, look up its source and demo:

Source Code Location Pattern

packages/components/src/{category}/{ComponentName}/

Categories:

Demo Location Pattern

packages/kit/src/views/Developer/pages/Gallery/Components/stories/{ComponentName}.tsx

Note: Some demos have different names (e.g., AccordionGallery.tsx, NewTabsGallery.tsx)

How to Look Up a Component

  1. Read the source to understand props and structure:

```text

Read: packages/components/src/{category}/{ComponentName}/index.tsx

```

  1. Read the demo for usage examples:

```text

Glob: packages/kit/src/views/Developer/pages/Gallery/Components/stories/{ComponentName}.tsx

```

Quick Reference

All imports from `@onekeyhq/components`

import { Button, Stack, XStack, YStack, Icon, ... } from '@onekeyhq/components';

Spacing Tokens

Color Tokens

Font Size Tokens

Headings (large to small):

Body text (large to small):

With medium weight (append Medium):

Usage with SizableText:

<SizableText size="$bodyMd">Regular text</SizableText>
<SizableText size="$bodyMdMedium">Medium weight text</SizableText>
<SizableText size="$headingSm">Small heading</SizableText>

Common Patterns

Layout with Stack:

<YStack gap="$4">        {/* Vertical */}
<XStack gap="$4">        {/* Horizontal */}
<Stack gap="$4">         {/* Default vertical */}

Mock Data:

const mockItems = [
  { name: 'Bitcoin', symbol: 'BTC', value: '$21,432.50' },
  { name: 'Ethereum', symbol: 'ETH', value: '$5,892.30' },
];

Button Actions:

<Button onPress={() => console.log('clicked')}>Action</Button>

Workflow

  1. Analyze the Figma design using Figma MCP
  2. Identify which components are needed
  3. Look up each component - read source and demo on-demand
  4. Create mock data matching the design
  5. Implement the UI with hardcoded values
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.