@nationaldesignstudio/react 0.0.15 → 0.0.16

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.
Files changed (164) hide show
  1. package/package.json +3 -2
  2. package/src/App.css +0 -0
  3. package/src/App.tsx +7 -0
  4. package/src/assets/fonts/PPNeueMontreal-Variable.woff2 +0 -0
  5. package/src/assets/react.svg +1 -0
  6. package/src/components/atoms/accordion/accordion.stories.tsx +228 -0
  7. package/src/components/atoms/accordion/accordion.tsx +219 -0
  8. package/src/components/atoms/accordion/index.ts +6 -0
  9. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-darwin.png +0 -0
  10. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-linux.png +0 -0
  11. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-darwin.png +0 -0
  12. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-linux.png +0 -0
  13. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-darwin.png +0 -0
  14. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-linux.png +0 -0
  15. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-darwin.png +0 -0
  16. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-linux.png +0 -0
  17. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-darwin.png +0 -0
  18. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-linux.png +0 -0
  19. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-darwin.png +0 -0
  20. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-linux.png +0 -0
  21. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-darwin.png +0 -0
  22. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-linux.png +0 -0
  23. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-darwin.png +0 -0
  24. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-linux.png +0 -0
  25. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-darwin.png +0 -0
  26. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-linux.png +0 -0
  27. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-darwin.png +0 -0
  28. package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-linux.png +0 -0
  29. package/src/components/atoms/button/button.stories.tsx +102 -0
  30. package/src/components/atoms/button/button.test.tsx +135 -0
  31. package/src/components/atoms/button/button.tsx +139 -0
  32. package/src/components/atoms/button/button.visual.test.tsx +102 -0
  33. package/src/components/atoms/button/icon-button.stories.tsx +166 -0
  34. package/src/components/atoms/button/icon-button.tsx +120 -0
  35. package/src/components/atoms/button/index.ts +6 -0
  36. package/src/components/atoms/ndstudio-footer/index.ts +1 -0
  37. package/src/components/atoms/ndstudio-footer/ndstudio-footer.tsx +55 -0
  38. package/src/components/atoms/pager-control/index.ts +5 -0
  39. package/src/components/atoms/pager-control/pager-control.stories.tsx +209 -0
  40. package/src/components/atoms/pager-control/pager-control.test.tsx +130 -0
  41. package/src/components/atoms/pager-control/pager-control.tsx +329 -0
  42. package/src/components/dev-tools/dev-toolbar/dev-toolbar.stories.tsx +82 -0
  43. package/src/components/dev-tools/dev-toolbar/dev-toolbar.tsx +196 -0
  44. package/src/components/dev-tools/dev-toolbar/index.ts +1 -0
  45. package/src/components/dev-tools/grid-overlay/grid-overlay.tsx +41 -0
  46. package/src/components/dev-tools/grid-overlay/index.ts +1 -0
  47. package/src/components/dev-tools/index.ts +2 -0
  48. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-darwin.png +0 -0
  49. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-linux.png +0 -0
  50. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-darwin.png +0 -0
  51. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-linux.png +0 -0
  52. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-darwin.png +0 -0
  53. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-linux.png +0 -0
  54. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-darwin.png +0 -0
  55. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-linux.png +0 -0
  56. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-darwin.png +0 -0
  57. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-linux.png +0 -0
  58. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-darwin.png +0 -0
  59. package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-linux.png +0 -0
  60. package/src/components/organisms/card/card.stories.tsx +293 -0
  61. package/src/components/organisms/card/card.test.tsx +245 -0
  62. package/src/components/organisms/card/card.tsx +225 -0
  63. package/src/components/organisms/card/card.visual.test.tsx +197 -0
  64. package/src/components/organisms/card/index.ts +19 -0
  65. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-darwin.png +0 -0
  66. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-linux.png +0 -0
  67. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-darwin.png +0 -0
  68. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-linux.png +0 -0
  69. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-darwin.png +0 -0
  70. package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-linux.png +0 -0
  71. package/src/components/organisms/navbar/index.ts +18 -0
  72. package/src/components/organisms/navbar/navbar.stories.tsx +313 -0
  73. package/src/components/organisms/navbar/navbar.test.tsx +190 -0
  74. package/src/components/organisms/navbar/navbar.tsx +323 -0
  75. package/src/components/organisms/navbar/navbar.visual.test.tsx +85 -0
  76. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-darwin.png +0 -0
  77. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-linux.png +0 -0
  78. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-darwin.png +0 -0
  79. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-linux.png +0 -0
  80. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-darwin.png +0 -0
  81. package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-linux.png +0 -0
  82. package/src/components/organisms/us-gov-banner/index.ts +1 -0
  83. package/src/components/organisms/us-gov-banner/us-gov-banner.stories.tsx +35 -0
  84. package/src/components/organisms/us-gov-banner/us-gov-banner.test.tsx +107 -0
  85. package/src/components/organisms/us-gov-banner/us-gov-banner.tsx +73 -0
  86. package/src/components/organisms/us-gov-banner/us-gov-banner.visual.test.tsx +46 -0
  87. package/src/components/sections/banner/banner.stories.tsx +150 -0
  88. package/src/components/sections/banner/banner.test.tsx +185 -0
  89. package/src/components/sections/banner/banner.tsx +130 -0
  90. package/src/components/sections/banner/index.ts +2 -0
  91. package/src/components/sections/card-grid/card-grid.stories.tsx +351 -0
  92. package/src/components/sections/card-grid/card-grid.tsx +116 -0
  93. package/src/components/sections/card-grid/index.ts +1 -0
  94. package/src/components/sections/faq-section/faq-section.stories.tsx +453 -0
  95. package/src/components/sections/faq-section/faq-section.tsx +84 -0
  96. package/src/components/sections/faq-section/index.ts +2 -0
  97. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-darwin.png +0 -0
  98. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-linux.png +0 -0
  99. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-darwin.png +0 -0
  100. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-linux.png +0 -0
  101. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-darwin.png +0 -0
  102. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-linux.png +0 -0
  103. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-darwin.png +0 -0
  104. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-linux.png +0 -0
  105. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-darwin.png +0 -0
  106. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-linux.png +0 -0
  107. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-darwin.png +0 -0
  108. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-linux.png +0 -0
  109. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-darwin.png +0 -0
  110. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-linux.png +0 -0
  111. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-darwin.png +0 -0
  112. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-linux.png +0 -0
  113. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-darwin.png +0 -0
  114. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-linux.png +0 -0
  115. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-darwin.png +0 -0
  116. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-linux.png +0 -0
  117. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-default-chromium-linux.png +0 -0
  118. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-darwin.png +0 -0
  119. package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-linux.png +0 -0
  120. package/src/components/sections/hero/hero.stories.tsx +274 -0
  121. package/src/components/sections/hero/hero.test.tsx +135 -0
  122. package/src/components/sections/hero/hero.tsx +453 -0
  123. package/src/components/sections/hero/hero.visual.test.tsx +140 -0
  124. package/src/components/sections/hero/index.ts +10 -0
  125. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-darwin.png +0 -0
  126. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-linux.png +0 -0
  127. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-darwin.png +0 -0
  128. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-linux.png +0 -0
  129. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-darwin.png +0 -0
  130. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-linux.png +0 -0
  131. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-darwin.png +0 -0
  132. package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-linux.png +0 -0
  133. package/src/components/sections/prose/index.ts +6 -0
  134. package/src/components/sections/prose/prose.stories.tsx +144 -0
  135. package/src/components/sections/prose/prose.test.tsx +178 -0
  136. package/src/components/sections/prose/prose.tsx +88 -0
  137. package/src/components/sections/prose/prose.visual.test.tsx +105 -0
  138. package/src/components/sections/river/index.ts +1 -0
  139. package/src/components/sections/river/river.stories.tsx +237 -0
  140. package/src/components/sections/river/river.test.tsx +268 -0
  141. package/src/components/sections/river/river.tsx +173 -0
  142. package/src/components/sections/tout/index.ts +1 -0
  143. package/src/components/sections/tout/tout.stories.tsx +171 -0
  144. package/src/components/sections/tout/tout.test.tsx +242 -0
  145. package/src/components/sections/tout/tout.tsx +270 -0
  146. package/src/components/sections/two-column-section/index.ts +5 -0
  147. package/src/components/sections/two-column-section/two-column-section.stories.tsx +285 -0
  148. package/src/components/sections/two-column-section/two-column-section.tsx +162 -0
  149. package/src/hooks/index.ts +1 -0
  150. package/src/hooks/use-event-listener.ts +73 -0
  151. package/src/index.ts +155 -0
  152. package/src/lib/theme.ts +1000 -0
  153. package/src/lib/utils.ts +6 -0
  154. package/src/main.tsx +13 -0
  155. package/src/stories/GridSystem.stories.tsx +84 -0
  156. package/src/stories/Introduction.mdx +114 -0
  157. package/src/stories/ThemeProvider.stories.tsx +357 -0
  158. package/src/stories/TokenShowcase.stories.tsx +92 -0
  159. package/src/stories/TokenShowcase.tsx +1429 -0
  160. package/src/styles.css +11 -0
  161. package/src/theme/ThemeProvider.tsx +297 -0
  162. package/src/theme/hooks.ts +40 -0
  163. package/src/theme/index.ts +43 -0
  164. package/src/theme/utils.ts +104 -0
@@ -0,0 +1,351 @@
1
+ import type { Meta, StoryObj } from "@storybook/react-vite";
2
+ import { Button } from "../../atoms/button";
3
+ import {
4
+ Card,
5
+ CardActions,
6
+ CardBody,
7
+ CardContent,
8
+ CardDescription,
9
+ CardEyebrow,
10
+ CardImage,
11
+ CardTitle,
12
+ } from "../../organisms/card";
13
+ import { CardGrid } from ".";
14
+
15
+ const meta: Meta<typeof CardGrid> = {
16
+ title: "Sections/CardGrid",
17
+ component: CardGrid,
18
+ parameters: {
19
+ layout: "fullscreen",
20
+ },
21
+ argTypes: {
22
+ variant: {
23
+ control: "select",
24
+ options: ["A", "B"],
25
+ description:
26
+ "Layout variant: A = 3 cols on desktop, B = 2 cols on desktop",
27
+ },
28
+ title: {
29
+ control: "text",
30
+ description: "The title text displayed above the cards",
31
+ },
32
+ },
33
+ } as Meta<typeof CardGrid>;
34
+
35
+ export default meta;
36
+ type Story = StoryObj<typeof CardGrid>;
37
+
38
+ const SampleCard = ({
39
+ title,
40
+ description,
41
+ }: {
42
+ title: string;
43
+ description: string;
44
+ }) => (
45
+ <Card>
46
+ <CardImage src="https://images.unsplash.com/photo-1551434678-e076c223a692?w=800&h=450&fit=crop" />
47
+ <CardContent>
48
+ <CardBody>
49
+ <CardEyebrow>Category</CardEyebrow>
50
+ <CardTitle>{title}</CardTitle>
51
+ <CardDescription>{description}</CardDescription>
52
+ </CardBody>
53
+ <CardActions>
54
+ <Button size="sm">Learn More</Button>
55
+ </CardActions>
56
+ </CardContent>
57
+ </Card>
58
+ );
59
+
60
+ const PlaceholderCard = ({
61
+ title,
62
+ description,
63
+ }: {
64
+ title: string;
65
+ description: string;
66
+ }) => (
67
+ <Card>
68
+ <CardImage>
69
+ <div className="absolute inset-0 bg-gray-200 flex items-center justify-center">
70
+ <span className="text-gray-500 typography-body-small">
71
+ Image Placeholder
72
+ </span>
73
+ </div>
74
+ </CardImage>
75
+ <CardContent>
76
+ <CardBody>
77
+ <CardEyebrow>Category</CardEyebrow>
78
+ <CardTitle>{title}</CardTitle>
79
+ <CardDescription>{description}</CardDescription>
80
+ </CardBody>
81
+ <CardActions>
82
+ <Button size="sm">Learn More</Button>
83
+ </CardActions>
84
+ </CardContent>
85
+ </Card>
86
+ );
87
+
88
+ const sampleCards = [
89
+ <PlaceholderCard
90
+ key="1"
91
+ title="First Card"
92
+ description="This is a sample card description that provides context about the content."
93
+ />,
94
+ <PlaceholderCard
95
+ key="2"
96
+ title="Second Card"
97
+ description="Another card with a brief description explaining its purpose."
98
+ />,
99
+ <PlaceholderCard
100
+ key="3"
101
+ title="Third Card"
102
+ description="A third card to demonstrate the grid layout behavior."
103
+ />,
104
+ <PlaceholderCard
105
+ key="4"
106
+ title="Fourth Card"
107
+ description="The final card in this example grid layout."
108
+ />,
109
+ ];
110
+
111
+ export const Playground: Story = {
112
+ render: (args) => <CardGrid {...args} />,
113
+ };
114
+ Playground.args = {
115
+ variant: "A",
116
+ title: "Featured Content",
117
+ cards: sampleCards,
118
+ };
119
+
120
+ // =============================================================================
121
+ // Variants
122
+ // =============================================================================
123
+
124
+ /**
125
+ * Variant A: 3 columns on desktop, 2 on tablet, 1 on mobile
126
+ */
127
+ export const VariantA: Story = {
128
+ render: () => (
129
+ <CardGrid
130
+ variant="A"
131
+ title="Our Services"
132
+ cards={sampleCards.slice(0, 4)}
133
+ />
134
+ ),
135
+ };
136
+
137
+ /**
138
+ * Variant B: 2 columns on desktop/tablet, 1 on mobile
139
+ */
140
+ export const VariantB: Story = {
141
+ render: () => (
142
+ <CardGrid
143
+ variant="B"
144
+ title="Featured Articles"
145
+ cards={sampleCards.slice(0, 4)}
146
+ />
147
+ ),
148
+ };
149
+
150
+ export const VariantBDesktop: Story = {
151
+ render: () => (
152
+ <CardGrid
153
+ variant="B"
154
+ title="Desktop View (Variant B)"
155
+ cards={[
156
+ <PlaceholderCard
157
+ key="1"
158
+ title="Card One"
159
+ description="Variant B displays 2 columns on desktop instead of 3."
160
+ />,
161
+ <PlaceholderCard
162
+ key="2"
163
+ title="Card Two"
164
+ description="This is useful for larger card layouts or featured content."
165
+ />,
166
+ ]}
167
+ />
168
+ ),
169
+ globals: {
170
+ viewport: { value: "lg", isRotated: false },
171
+ },
172
+ };
173
+
174
+ // =============================================================================
175
+ // Responsive Variants
176
+ // =============================================================================
177
+
178
+ export const VariantADesktop: Story = {
179
+ render: () => (
180
+ <CardGrid
181
+ variant="A"
182
+ title="Desktop View"
183
+ cards={[
184
+ <PlaceholderCard
185
+ key="1"
186
+ title="Card One"
187
+ description="On desktop (lg, 1440px), cards are displayed in a 2-column grid with 12 columns each."
188
+ />,
189
+ <PlaceholderCard
190
+ key="2"
191
+ title="Card Two"
192
+ description="The layout uses 128px vertical padding and 64px gap between title and cards."
193
+ />,
194
+ <PlaceholderCard
195
+ key="3"
196
+ title="Card Three"
197
+ description="The layout uses 128px vertical padding and 64px gap between title and cards."
198
+ />,
199
+ ]}
200
+ />
201
+ ),
202
+ globals: {
203
+ viewport: { value: "lg", isRotated: false },
204
+ },
205
+ };
206
+
207
+ export const VariantATablet: Story = {
208
+ render: () => (
209
+ <CardGrid
210
+ variant="A"
211
+ title="Tablet View"
212
+ cards={[
213
+ <PlaceholderCard
214
+ key="1"
215
+ title="Card One"
216
+ description="On tablet (md, 768px), cards are in a 2-column layout with 56px gap from title."
217
+ />,
218
+ <PlaceholderCard
219
+ key="2"
220
+ title="Card Two"
221
+ description="Cards maintain the 12/12 column split on tablet viewports."
222
+ />,
223
+ ]}
224
+ />
225
+ ),
226
+ globals: {
227
+ viewport: { value: "md", isRotated: false },
228
+ },
229
+ };
230
+
231
+ export const VariantAMobile: Story = {
232
+ render: () => (
233
+ <CardGrid
234
+ variant="A"
235
+ title="Mobile View"
236
+ cards={[
237
+ <PlaceholderCard
238
+ key="1"
239
+ title="Card One"
240
+ description="On mobile (sm, 320px), cards stack in a single column."
241
+ />,
242
+ <PlaceholderCard
243
+ key="2"
244
+ title="Card Two"
245
+ description="Each card takes full width on mobile devices."
246
+ />,
247
+ ]}
248
+ />
249
+ ),
250
+ globals: {
251
+ viewport: { value: "sm", isRotated: false },
252
+ },
253
+ };
254
+
255
+ // =============================================================================
256
+ // Examples
257
+ // =============================================================================
258
+
259
+ /**
260
+ * Two cards in grid
261
+ */
262
+ export const TwoCards: Story = {
263
+ render: () => (
264
+ <CardGrid
265
+ variant="A"
266
+ title="Two Card Layout"
267
+ cards={sampleCards.slice(0, 2)}
268
+ />
269
+ ),
270
+ };
271
+
272
+ /**
273
+ * Four cards in grid (2 rows)
274
+ */
275
+ export const FourCards: Story = {
276
+ render: () => (
277
+ <CardGrid variant="A" title="Four Card Layout" cards={sampleCards} />
278
+ ),
279
+ };
280
+
281
+ /**
282
+ * Six cards in grid (3 rows)
283
+ */
284
+ export const SixCards: Story = {
285
+ render: () => (
286
+ <CardGrid
287
+ variant="A"
288
+ title="Six Card Layout"
289
+ cards={[
290
+ ...sampleCards,
291
+ <PlaceholderCard
292
+ key="5"
293
+ title="Fifth Card"
294
+ description="Additional card to show multiple rows."
295
+ />,
296
+ <PlaceholderCard
297
+ key="6"
298
+ title="Sixth Card"
299
+ description="The grid handles any number of cards."
300
+ />,
301
+ ]}
302
+ />
303
+ ),
304
+ };
305
+
306
+ /**
307
+ * With actual images
308
+ */
309
+ export const WithImages: Story = {
310
+ render: () => (
311
+ <CardGrid
312
+ variant="A"
313
+ title="Featured Resources"
314
+ cards={[
315
+ <SampleCard
316
+ key="1"
317
+ title="Getting Started Guide"
318
+ description="Learn the basics and get up and running quickly with our comprehensive guide."
319
+ />,
320
+ <SampleCard
321
+ key="2"
322
+ title="Best Practices"
323
+ description="Discover proven strategies and techniques to maximize your results."
324
+ />,
325
+ <SampleCard
326
+ key="3"
327
+ title="Advanced Topics"
328
+ description="Deep dive into advanced features and configurations."
329
+ />,
330
+ <SampleCard
331
+ key="4"
332
+ title="Case Studies"
333
+ description="See how others have achieved success with real-world examples."
334
+ />,
335
+ ]}
336
+ />
337
+ ),
338
+ };
339
+
340
+ /**
341
+ * Odd number of cards
342
+ */
343
+ export const OddNumberOfCards: Story = {
344
+ render: () => (
345
+ <CardGrid
346
+ variant="A"
347
+ title="Three Card Layout"
348
+ cards={sampleCards.slice(0, 3)}
349
+ />
350
+ ),
351
+ };
@@ -0,0 +1,116 @@
1
+ import * as React from "react";
2
+ import { tv, type VariantProps } from "tailwind-variants";
3
+ import { cn } from "@/lib/utils";
4
+
5
+ /**
6
+ * CardGrid component for displaying cards in a responsive grid layout
7
+ *
8
+ * Variants:
9
+ * - A: 3 columns on desktop, 2 on tablet, 1 on mobile
10
+ * - B: 2 columns on desktop/tablet, 1 on mobile
11
+ *
12
+ * Uses the 24-column grid system with grid-container as root.
13
+ */
14
+ const cardGridVariants = tv({
15
+ // Base styles - grid-container for proper grid context - uses primitive spacing tokens
16
+ base: [
17
+ "grid-container",
18
+ // Small (mobile): 72px y padding
19
+ "py-spacing-72",
20
+ // Large (desktop): 128px y padding
21
+ "lg:py-spacing-128",
22
+ ],
23
+ variants: {
24
+ variant: {
25
+ A: "",
26
+ B: "",
27
+ },
28
+ },
29
+ defaultVariants: {
30
+ variant: "A",
31
+ },
32
+ });
33
+
34
+ export interface CardGridProps
35
+ extends React.HTMLAttributes<HTMLElement>,
36
+ VariantProps<typeof cardGridVariants> {
37
+ /**
38
+ * The title text displayed above the cards
39
+ */
40
+ title: string;
41
+ /**
42
+ * The card elements to display in the grid
43
+ */
44
+ cards: React.ReactNode[];
45
+ }
46
+
47
+ /**
48
+ * CardGrid component for displaying cards in a responsive grid layout.
49
+ *
50
+ * Uses the 24-column grid system with grid-container as root.
51
+ *
52
+ * Layout (Variant A):
53
+ * - Mobile (sm): Single column, py-72
54
+ * - Tablet (md): 2 columns, gap-56 between title and cards, gap-y-20 between cards
55
+ * - Desktop (lg+): 3 columns, py-128, gap-64 between title and cards, gap-y-20 between cards
56
+ *
57
+ * Layout (Variant B):
58
+ * - Mobile (sm): Single column, py-72
59
+ * - Tablet (md): 2 columns, gap-56 between title and cards, gap-y-20 between cards
60
+ * - Desktop (lg+): 2 columns, py-128, gap-64 between title and cards, gap-y-20 between cards
61
+ *
62
+ * @example
63
+ * ```tsx
64
+ * <CardGrid
65
+ * variant="A"
66
+ * title="Featured Cards"
67
+ * cards={[
68
+ * <Card key="1">...</Card>,
69
+ * <Card key="2">...</Card>,
70
+ * ]}
71
+ * />
72
+ * ```
73
+ */
74
+ const CardGrid = React.forwardRef<HTMLElement, CardGridProps>(
75
+ ({ className, variant, title, cards, ...props }, ref) => {
76
+ return (
77
+ <section
78
+ ref={ref}
79
+ className={cardGridVariants({ variant, class: className })}
80
+ {...props}
81
+ >
82
+ {/* Title - col-full within grid - uses primitive spacing tokens */}
83
+ <h2
84
+ className={cn(
85
+ "col-full",
86
+ "typography-headline-small text-gray-900",
87
+ // Gap after title: mobile default, md: 56px, lg: 64px
88
+ "mb-spacing-36 md:mb-spacing-56 lg:mb-spacing-64",
89
+ )}
90
+ >
91
+ {title}
92
+ </h2>
93
+
94
+ {/* Inner grid for cards - uses primitive spacing tokens */}
95
+ <div
96
+ className={cn(
97
+ "col-full",
98
+ // Mobile: single column
99
+ "grid grid-cols-1 gap-spacing-20",
100
+ // Tablet: 2 columns
101
+ "md:grid-cols-2",
102
+ // Desktop: 3 columns for variant A, 2 columns for variant B
103
+ variant === "A" && "lg:grid-cols-3",
104
+ )}
105
+ >
106
+ {React.Children.toArray(cards).map((card) => (
107
+ <div key={(card as React.ReactElement).key}>{card}</div>
108
+ ))}
109
+ </div>
110
+ </section>
111
+ );
112
+ },
113
+ );
114
+ CardGrid.displayName = "CardGrid";
115
+
116
+ export { CardGrid, cardGridVariants };
@@ -0,0 +1 @@
1
+ export { CardGrid, type CardGridProps, cardGridVariants } from "./card-grid";