File tree Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Expand file tree Collapse file tree 1 file changed +41
-0
lines changed Original file line number Diff line number Diff line change
1
+ # ADR XXX: File structure
2
+
3
+ ## Status
4
+
5
+ Proposed
6
+
7
+ ## Context
8
+
9
+ Components might be more grokable if they were structured consistently. This ADR proposes conventions
10
+
11
+ ## Decision
12
+
13
+ TL;DR:
14
+
15
+ ```
16
+ primer-react/
17
+ ├─ src/
18
+ │ ├─ Breadcrumbs/
19
+ │ │ ├─ index.ts // Just re-exporting?
20
+ │ │ ├─ Breadcrumbs.tsx // Primary component
21
+ │ │ ├─ BreadcrumbsItem.tsx // Subcomponent (include parent component name to increase findability in most IDEs)
22
+ │ │ ├─ Breadcrumbs.mdx // Documentation. Always .mdx, not .md
23
+ │ │ ├─ Breadcrumbs.stories.tsx
24
+ │ │ ├─ Breadcrumbs.test.tsx // Unit tests
25
+ │ │ ├─ Breadcrumbs.types.test.tsx // Type tests
26
+ │ │ ├─ Breadcrumbs.yml // Component metadata (Possible future)
27
+ │ │ └─ __snapshots__/
28
+ ┆ ┆
29
+ ```
30
+
31
+ ### Rules
32
+
33
+ - Every component should have its own PascalCased directory directly under ` src/ `
34
+ - Subcomponents should be properties of the exported parent component (e.g., ` Breadcrumbs.Item ` )
35
+ - Replacements of existing components should use an incrementing number (e.g., ` Breadcrumbs2 ` rather than ` NewBreadcrumbs ` )
36
+
37
+ ## Implementation
38
+
39
+ - [ ] Migrate components into this structure
40
+ - [ ] Set up tests for the component structure
41
+ - [ ] Mark this ADR as adopted
You can’t perform that action at this time.
0 commit comments