@mallardbay/cursor-rules 1.0.34 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,91 +0,0 @@
1
- ---
2
- description: Defines best practices for building consistent, maintainable, and responsive UI in Mallard Bay projects
3
- globs:
4
- alwaysApply: true
5
- ---
6
-
7
- # UI Development Standards
8
-
9
- ## Theme Usage
10
-
11
- Use theme values consistently across all components:
12
-
13
- ### Colors
14
-
15
- - Use theme colors instead of hardcoded values
16
- - Example: `theme.colors.primary` instead of `'#000000'`
17
-
18
- ### Spacing
19
-
20
- - Use theme spacing values for margins and padding
21
- - Example: `theme.space[4]` instead of `'16px'`
22
-
23
- ### Typography
24
-
25
- - Use theme typography settings for text styles
26
- - Example: `theme.fontSizes.md` instead of `'16px'`
27
-
28
- ### Borders and border radius
29
-
30
- - Use theme border styles and radius values
31
- - Examples: `theme.borders.sm` instead of `'1px solid'`, `theme.radii.md` instead of using px values
32
-
33
- ## Component Structure
34
-
35
- Maintain clean and consistent component structure:
36
-
37
- ### Nesting
38
-
39
- - Limit component nesting to maximum depth of 3
40
- - Keep component hierarchy readable and maintainable
41
-
42
- ### Inline Styles
43
-
44
- - Limit inline styles to maximum of 2 per component
45
- - Prefer theme-based styling
46
-
47
- ### Component Library
48
-
49
- - Use existing components in @mallardbay/lib-react-components, @mallardbay/lib-react-components is based off Crakra UI v2
50
- - If no component available in @mallardbay/lib-react-components, create one using Crakra UI and place it under src/components/shared/todo-lib-react-components/ to me moved later
51
-
52
- ## Responsive Design
53
-
54
- Ensure responsive and accessible design:
55
-
56
- ### Breakpoints
57
-
58
- - Use theme breakpoints for responsive design
59
- - Implement mobile-first approach
60
-
61
- ### Spacing
62
-
63
- - Use responsive spacing values
64
- - Adapt layouts for different screen sizes
65
-
66
- ### Animations
67
-
68
- - Use theme transition values for animations
69
- - Keep animations smooth and performant
70
-
71
- ### Rendering
72
-
73
- - Optimize component rendering
74
- - Avoid unnecessary re-renders
75
- - Use React.memo and useMemo when appropriate
76
- - Avoid defining functions inside components to prevent recreation on each render
77
- - Move function definitions outside components or use useCallback for event handlers
78
- - Use useCallback for functions passed as props to child components
79
- - Use useMemo for expensive computations and complex data transformations
80
- - Memoize filtered, sorted, or mapped arrays to avoid recalculation on every render
81
- - Use useMemo for object/array creation that would otherwise be recreated on each render
82
-
83
- ## File Patterns
84
-
85
- These rules apply to all TypeScript and TSX files in the project.
86
-
87
- ## Components
88
-
89
- - Keep components small and focused on a single responsibility
90
- - Use functional components with hooks instead of class components
91
- - Prefer `export default function ImpersonationBox() {` over `function ImpersonationBox(): React.ReactElement | null {` when defining components