← 返回列表
全部 Skill›开发 Development›ui4

ui4

作者 @payloadcms · 语言 en
Manually invoked skill for reskinning Payload UI components. Requires Figma URL. Usage: /ui4
开发 Development前端开发需海外环境执行命令访问网络待翻译
最近源活动
—
检测 SKILL.md 语言
en
星标 ★
45,976
分支 Fork
0
安装选项
提示
指令
使用 AI 助手安装
将下面的提示复制到你正在使用的 AI 助手中。
下载完整 Skill 目录(含全部配套文件)。 下载压缩包 ↓
SKILL.md 原文预览

Payload UI Reskin (ui4)

Figma URL is REQUIRED. If not provided, ask before proceeding.


Process

Step 0: Icon Scan

Goal: Identify icon dependencies before starting work.

  1. Scan component files for icon imports:

```

grep -E "from.*icons|import.*Icon" packages/ui/src/elements/ComponentName/

```

  1. List existing icons in packages/ui/src/icons/:
  • Each icon has its own folder with index.tsx + index.css
  1. Compare Figma design to available icons:
  • Does the design use icons not currently in the component?
  • Does the design use icons that don't exist yet?
  1. Document findings:
  • Existing & used: No action needed
  • Existing but not imported: Will need to add import
  • Missing from codebase: Flag for user — need to source/create icon

Figma Icons Source:

When updating or creating icons, reference the Figma icon library at:

~/figma/figma/fpl/icons/src/icons/

Icon naming convention: icon-{size}-{name}.tsx (e.g., icon-16-close.tsx, icon-24-chevron-down.tsx)

To find the correct icon:

  1. Note the icon name from Figma design (e.g., "close", "chevron-down")
  2. Check both 16px and 24px variants if they exist
  3. Read the corresponding files and extract the SVG paths for each size

Icon implementation rules:

  1. Props: Icon components MUST accept these props (keep existing props when updating):

```typescript

type IconProps = {

readonly className?: string

readonly size?: 16 | 24 // Add more sizes as needed

// ... keep any existing component-specific props

}

```

  1. Multi-size support: Store path data keyed by size:

```typescript

const paths = {

16: 'M4.854 4.146...', // from icon-16-{name}.tsx

24: 'M6.854 6.146...', // from icon-24-{name}.tsx

}

```

  1. SVG rendering: Use the size prop to select path and viewBox:

```tsx

<svg width={size} height={size} viewBox={0 0 ${size} ${size}} fill="none">

<path d={paths[size]} fill="currentColor" />

</svg>

```

  1. Payload conventions:
  • Use fill="currentColor" instead of fill="var(--color-icon)"
  • Use fillRule and clipRule (React camelCase) instead of kebab-case
  • Default size should match most common usage (typically 24)
  1. Reference implementation: See packages/ui/src/icons/Chevron/index.tsx for the pattern.

If icons are missing from Figma source: Ask user how to proceed before continuing.


Step 1: SCSS → CSS Migration

Goal: Syntax conversion only. Component must look IDENTICAL after.

  1. Read component files: packages/ui/src/elements/ComponentName/ or packages/ui/src/fields/ComponentName/
  2. Create index.css with converted styles:
  • $var → var(--token)
  • Keep CSS nesting with & (preferred)
  • Remove @use/@import (tokens are global)
  • Inline any mixins
  1. Update import: import './index.scss' → import './index.css'
  2. Delete index.scss
  3. Wrap in @layer payload-default {}
  4. Convert legacy var(--base) to --spacer tokens (see below)
  5. Check for SCSS-only variables (see below)

#### SCSS Variable Dependencies

CRITICAL: The packages/ui/src/scss/ folder has been removed. All global tokens now live in packages/ui/src/css/. Any CSS variable you use must exist there.

Before using a variable, verify it exists in the CSS folder:

grep -r "variable-name" packages/ui/src/css/

If a variable is only in SCSS:

  1. Check if there's an equivalent in the CSS folder
  2. If not, add it to the appropriate CSS file:
  • spacing.css — spacers, gutters, layout spacing, breakpoints
  • colors.css — color tokens
  • typography.css — font tokens
  • radius.css — border-radius tokens
  • utilities.css — accessibility, misc utilities

Common SCSS-only variables to watch for:

| SCSS Variable | CSS Equivalent / Action |

| ----------------------- | ------------------------------------------------ |

| --spacing-view-bottom | Defined in spacing.css |

| --breakpoint-m-width | Defined in spacing.css (1024px) |

| --breakpoint-s-width | Defined in spacing.css (768px) |

| --gutter-h | Defined in spacing.css |

| $breakpoint-m-width | Use var(--breakpoint-m-width) in media queries |

| @include mid-break | Use @media (max-width: 1024px) |

| @include small-break | Use @media (max-width: 768px) |


#### Legacy Token Migration: var(--base) → --spacer

What is --base? A legacy spacing token equal to 20px (1.25rem). It must be replaced with --spacer-* tokens.

Spacer token values:

| Token | Value | Pixels |

| -------------- | ----- | ------ |

| --spacer-0 | 0 | 0px |

| --spacer-1 | 4px | 4px |

| --spacer-2 | 8px | 8px |

| --spacer-2-5 | 12px | 12px |

| --spacer-3 | 16px | 16px |

| --spacer-4 | 24px | 24px |

| --spacer-5 | 32px | 32px |

| --spacer-6 | 40px | 40px |

Conversion strategy:

  1. Direct match: If the result equals a spacer token, use it directly:

```css

/* Before: var(--base) = 20px → closest is --spacer-3 (16px) or --spacer-4 (24px) */

padding: var(--base);

/* After: Choose semantically correct size */

padding: var(--spacer-4); /* if 24px is acceptable */

```

  1. Calculated values: When exact pixel value is important, use calc():

```css

/* Before: calc(var(--base) * 0.5) = 10px */

gap: calc(var(--base) * 0.5);

/* After: calc(var(--spacer-1) * 2.5) = 10px */

gap: calc(var(--spacer-1) * 2.5);

```

  1. ALWAYS round to nearest spacer token. Never use calc() to preserve non-standard pixel values.
评论
Ppayloadcms
payloadcms
payloadcms/payload
查看 GitHub 仓库 查看作者的其他 Skill
来源信息
作者@payloadcms
所属大类开发 Development / 前端开发
国内可用性需海外环境
最近源活动—
风险提示执行命令、访问网络
提示:风险标签为程序静态扫描结果,仅作提示,不代表安全认证。安装前请阅读 SKILL.md 及其引用的脚本、权限,自行判断是否可信。