Commit d71cc1c
authored
feat(components): Update Switch component design (#2897)
* Update visual test structure
* Move Switch Web.stories.tsx to v9 storybook location
* Modernize Switch stories to v9 format
- Update imports from ComponentMeta/ComponentStory to Meta/StoryObj from @storybook/react-vite
- Update meta export to use satisfies pattern with type export
- Remove /Web from title path
- Remove unnecessary parameters (viewMode, previewTabs)
- Update story definitions to use Story type with render property
- Update template functions to use Story["args"] type
* Update Switch docs links to point to v9 web storybook
* Update Switch design
* Remove old invisible label and update switch layout
The old label had opacity=0 from the last retheme we did. The label itself was powering the layout of the pip which was confusing and not consistent in the on vs off position.
Updated layout to use calculated positions which work much better.
* Regen screenshots
* Regen snapshots
* Add tests
* Fix css lint
* Regen FeatureSwitch screenshots
* Update Switch.stories.tsx
* Update Switch.module.css.d.ts
SB v7's build had to modify this file.
* Make screen readers ignore the icon
* Replace basic story with controlled case
The controlled case is the ONLY case, so having a basic story that does nothing doesn't make sense.
* Replace snapshot tests with actual logical tests1 parent f7a0a56 commit d71cc1c
File tree
16 files changed
+283
-341
lines changed- docs/components/Switch
- packages
- components/src
- FeatureSwitch/__snapshots__
- Switch
- site
- src
- content/Switch
- pages/visualTests
- tests/visual/site.visual.ts-snapshots
16 files changed
+283
-341
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
This file was deleted.
Lines changed: 15 additions & 21 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
125 | 126 | | |
126 | | - | |
127 | | - | |
128 | | - | |
129 | | - | |
130 | | - | |
131 | | - | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
138 | | - | |
139 | | - | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
140 | 132 | | |
141 | | - | |
142 | | - | |
143 | | - | |
144 | | - | |
145 | | - | |
146 | | - | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
147 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
148 | 142 | | |
149 | 143 | | |
150 | 144 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
5 | 4 | | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
11 | | - | |
| 15 | + | |
12 | 16 | | |
13 | 17 | | |
14 | 18 | | |
| |||
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | | - | |
| 27 | + | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
| |||
41 | 45 | | |
42 | 46 | | |
43 | 47 | | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
67 | 51 | | |
68 | 52 | | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
| 53 | + | |
79 | 54 | | |
80 | 55 | | |
81 | 56 | | |
82 | 57 | | |
83 | | - | |
84 | | - | |
| 58 | + | |
| 59 | + | |
85 | 60 | | |
86 | 61 | | |
87 | | - | |
| 62 | + | |
88 | 63 | | |
89 | 64 | | |
| 65 | + | |
90 | 66 | | |
91 | 67 | | |
92 | | - | |
| 68 | + | |
93 | 69 | | |
94 | 70 | | |
95 | 71 | | |
96 | 72 | | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
97 | 77 | | |
98 | 78 | | |
99 | 79 | | |
| |||
111 | 91 | | |
112 | 92 | | |
113 | 93 | | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
7 | | - | |
8 | 6 | | |
| 7 | + | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
0 commit comments