design-system-creation
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseDesign System Creation
设计系统创建
Build comprehensive design systems for consistent UI development across teams.
为跨团队的一致UI开发构建全面的设计系统。
Design System Layers
设计系统层级
- Foundation: Colors, typography, spacing, elevation
- Components: Buttons, inputs, cards, navigation
- Patterns: Forms, layouts, empty states
- 基础层:颜色、排版、间距、阴影层级
- 组件层:按钮、输入框、卡片、导航
- 模式层:表单、布局、空状态
Foundation - Design Tokens
基础层 - Design Tokens
css
:root {
/* Colors */
--color-primary-50: #eff6ff;
--color-primary-500: #3b82f6;
--color-primary-900: #1e3a8a;
/* Semantic colors */
--color-success: #22c55e;
--color-warning: #f59e0b;
--color-error: #ef4444;
/* Typography */
--font-sans: 'Inter', system-ui, sans-serif;
--font-mono: 'Fira Code', monospace;
/* Type scale */
--text-xs: 0.75rem;
--text-sm: 0.875rem;
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.25rem;
--text-2xl: 1.5rem;
/* Spacing (4px base) */
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-4: 1rem;
--space-8: 2rem;
/* Elevation */
--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
--shadow-md: 0 4px 6px rgba(0,0,0,0.1);
--shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}css
:root {
/* Colors */
--color-primary-50: #eff6ff;
--color-primary-500: #3b82f6;
--color-primary-900: #1e3a8a;
/* Semantic colors */
--color-success: #22c55e;
--color-warning: #f59e0b;
--color-error: #ef4444;
/* Typography */
--font-sans: 'Inter', system-ui, sans-serif;
--font-mono: 'Fira Code', monospace;
/* Type scale */
--text-xs: 0.75rem;
--text-sm: 0.875rem;
--text-base: 1rem;
--text-lg: 1.125rem;
--text-xl: 1.25rem;
--text-2xl: 1.5rem;
/* Spacing (4px base) */
--space-1: 0.25rem;
--space-2: 0.5rem;
--space-4: 1rem;
--space-8: 2rem;
/* Elevation */
--shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
--shadow-md: 0 4px 6px rgba(0,0,0,0.1);
--shadow-lg: 0 10px 15px rgba(0,0,0,0.1);
}Component Documentation
组件文档
markdown
undefinedmarkdown
undefinedButton
Button
Anatomy
结构
- Container (padding, background)
- Label (text)
- Icon (optional)
- 容器(内边距、背景)
- 标签(文本)
- 图标(可选)
Variants
变体
- Primary: Main actions
- Secondary: Alternative actions
- Ghost: Subtle actions
- Primary:主要操作
- Secondary:次要操作
- Ghost:轻量操作
States
状态
- Default, Hover, Active, Disabled, Loading
- 默认、悬停、激活、禁用、加载中
Accessibility
可访问性
- Role: button
- Keyboard: Enter/Space to activate
- Focus: Visible focus ring
undefined- 角色:button
- 键盘操作:Enter/Space键激活
- 焦点:可见焦点环
undefinedComponent Example (React)
React组件示例
tsx
interface ButtonProps {
variant?: 'primary' | 'secondary' | 'ghost';
size?: 'sm' | 'md' | 'lg';
loading?: boolean;
disabled?: boolean;
children: React.ReactNode;
}
function Button({ variant = 'primary', size = 'md', loading, disabled, children }: ButtonProps) {
return (
<button
className={`btn btn-${variant} btn-${size}`}
disabled={disabled || loading}
aria-busy={loading}
>
{loading ? <Spinner /> : children}
</button>
);
}tsx
interface ButtonProps {
variant?: 'primary' | 'secondary' | 'ghost';
size?: 'sm' | 'md' | 'lg';
loading?: boolean;
disabled?: boolean;
children: React.ReactNode;
}
function Button({ variant = 'primary', size = 'md', loading, disabled, children }: ButtonProps) {
return (
<button
className={`btn btn-${variant} btn-${size}`}
disabled={disabled || loading}
aria-busy={loading}
>
{loading ? <Spinner /> : children}
</button>
);
}Governance
治理机制
- Review Committee: Approves new components
- Contribution Process: RFC → Review → Implementation
- Versioning: Semantic versioning for releases
- Deprecation: 3-month notice with migration guide
- 评审委员会:审批新组件
- 贡献流程:RFC → 评审 → 实现
- 版本控制:采用语义化版本管理发布
- 废弃机制:提前3个月发布通知并提供迁移指南
Best Practices
最佳实践
- Start with foundational tokens
- Document every component thoroughly
- Ensure WCAG 2.1 AA compliance
- Support dark mode from the start
- Include usage guidelines with do/don't examples
- 从基础tokens开始构建
- 为每个组件编写详尽文档
- 确保符合WCAG 2.1 AA标准
- 从设计初期就支持dark mode
- 包含使用指南及正确/错误示例