new-component
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInstructions
说明
When creating new GPUI components:
- Follow existing patterns: Base implementation on components in (examples:
crates/ui/src,Button)Select - Style consistency: Follow existing component styles and Shadcn UI patterns
- Component type decision:
- Use stateless elements for simple components (like )
Button - Use stateful elements for complex components with data (like and
Select)SelectState
- Use stateless elements for simple components (like
- API consistency: Maintain the same API style as other elements
- Documentation: Create component documentation
- Stories: Write component stories in the story folder
创建新的GPUI组件时:
- 遵循现有模式:基于中的组件进行实现(示例:
crates/ui/src、Button)Select - 样式一致性:遵循现有组件样式及Shadcn UI模式
- 组件类型选择:
- 简单组件(如)使用无状态元素
Button - 带有数据的复杂组件(如和
Select)使用有状态元素SelectState
- 简单组件(如
- API一致性:保持与其他元素相同的API风格
- 文档编写:创建组件文档
- Story编写:在story文件夹中编写组件stories
Component Types
组件类型
- Stateless: Pure presentation components without internal state
- Stateful: Components that manage their own state and data
- 无状态(Stateless):无内部状态的纯展示型组件
- 有状态(Stateful):管理自身状态和数据的组件