@nationaldesignstudio/react 0.5.2 → 0.5.4
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.
- package/package.json +10 -2
- package/src/components/organisms/navbar/navbar.tsx +8 -8
- package/src/App.css +0 -0
- package/src/App.tsx +0 -7
- package/src/assets/fonts/PPNeueMontreal-Variable.woff2 +0 -0
- package/src/assets/react.svg +0 -1
- package/src/components/atoms/accordion/accordion.stories.tsx +0 -228
- package/src/components/atoms/accordion/accordion.test.tsx +0 -231
- package/src/components/atoms/accordion/index.ts +0 -6
- package/src/components/atoms/background/background.test.tsx +0 -213
- package/src/components/atoms/background/index.ts +0 -22
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-charcoal-outline-quiet-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-disabled-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-ivory-outline-quiet-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-large-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-medium-chromium-linux.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-darwin.png +0 -0
- package/src/components/atoms/button/__screenshots__/button.visual.test.tsx/button-size-small-chromium-linux.png +0 -0
- package/src/components/atoms/button/button.stories.tsx +0 -289
- package/src/components/atoms/button/button.test.tsx +0 -419
- package/src/components/atoms/button/button.visual.test.tsx +0 -98
- package/src/components/atoms/button/icon-button.stories.tsx +0 -260
- package/src/components/atoms/button/icon-button.test.tsx +0 -186
- package/src/components/atoms/button/index.ts +0 -6
- package/src/components/atoms/input/index.ts +0 -17
- package/src/components/atoms/input/input-group.stories.tsx +0 -646
- package/src/components/atoms/input/input-group.test.tsx +0 -362
- package/src/components/atoms/input/input.stories.tsx +0 -228
- package/src/components/atoms/input/input.test.tsx +0 -167
- package/src/components/atoms/ndstudio-footer/index.ts +0 -1
- package/src/components/atoms/pager-control/index.ts +0 -5
- package/src/components/atoms/pager-control/pager-control.stories.tsx +0 -207
- package/src/components/atoms/pager-control/pager-control.test.tsx +0 -130
- package/src/components/atoms/popover/index.ts +0 -30
- package/src/components/atoms/popover/popover.stories.tsx +0 -531
- package/src/components/atoms/popover/popover.test.tsx +0 -486
- package/src/components/atoms/select/index.ts +0 -18
- package/src/components/atoms/select/select.stories.tsx +0 -455
- package/src/components/atoms/tooltip/index.ts +0 -24
- package/src/components/atoms/tooltip/tooltip.stories.tsx +0 -348
- package/src/components/atoms/tooltip/tooltip.test.tsx +0 -363
- package/src/components/dev-tools/dev-toolbar/dev-toolbar.stories.tsx +0 -73
- package/src/components/dev-tools/dev-toolbar/index.ts +0 -1
- package/src/components/dev-tools/grid-overlay/index.ts +0 -1
- package/src/components/dev-tools/index.ts +0 -2
- package/src/components/foundation/typography/typography.stories.tsx +0 -401
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-default-vertical-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-horizontal-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-minimal-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-actions-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-eyebrow-chromium-linux.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-darwin.png +0 -0
- package/src/components/organisms/card/__screenshots__/card.visual.test.tsx/card-without-image-chromium-linux.png +0 -0
- package/src/components/organisms/card/card.stories.tsx +0 -293
- package/src/components/organisms/card/card.test.tsx +0 -247
- package/src/components/organisms/card/card.visual.test.tsx +0 -197
- package/src/components/organisms/card/index.ts +0 -26
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-active-link-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-brand-only-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-darwin.png +0 -0
- package/src/components/organisms/navbar/__screenshots__/navbar.visual.test.tsx/navbar-default-chromium-linux.png +0 -0
- package/src/components/organisms/navbar/index.ts +0 -18
- package/src/components/organisms/navbar/navbar.stories.tsx +0 -313
- package/src/components/organisms/navbar/navbar.test.tsx +0 -190
- package/src/components/organisms/navbar/navbar.visual.test.tsx +0 -85
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-icon-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-custom-text-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-darwin.png +0 -0
- package/src/components/organisms/us-gov-banner/__screenshots__/us-gov-banner.visual.test.tsx/us-gov-banner-default-chromium-linux.png +0 -0
- package/src/components/organisms/us-gov-banner/index.ts +0 -5
- package/src/components/organisms/us-gov-banner/us-gov-banner.stories.tsx +0 -35
- package/src/components/organisms/us-gov-banner/us-gov-banner.test.tsx +0 -107
- package/src/components/organisms/us-gov-banner/us-gov-banner.visual.test.tsx +0 -46
- package/src/components/sections/banner/banner.stories.tsx +0 -150
- package/src/components/sections/banner/banner.test.tsx +0 -185
- package/src/components/sections/banner/index.ts +0 -2
- package/src/components/sections/card-grid/card-grid.stories.tsx +0 -351
- package/src/components/sections/card-grid/index.ts +0 -1
- package/src/components/sections/faq-section/faq-section.stories.tsx +0 -453
- package/src/components/sections/faq-section/index.ts +0 -2
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a1-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a2-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-desktop-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-mobile-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-a3-tablet-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-custom-class-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-default-chromium-linux.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-darwin.png +0 -0
- package/src/components/sections/hero/__screenshots__/hero.visual.test.tsx/hero-long-title-chromium-linux.png +0 -0
- package/src/components/sections/hero/hero.stories.tsx +0 -397
- package/src/components/sections/hero/hero.test.tsx +0 -138
- package/src/components/sections/hero/hero.visual.test.tsx +0 -140
- package/src/components/sections/hero/index.ts +0 -23
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-h3-heading-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-paragraphs-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-multiple-sections-chromium-linux.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-darwin.png +0 -0
- package/src/components/sections/prose/__screenshots__/prose.visual.test.tsx/prose-single-section-chromium-linux.png +0 -0
- package/src/components/sections/prose/index.ts +0 -6
- package/src/components/sections/prose/prose.stories.tsx +0 -144
- package/src/components/sections/prose/prose.test.tsx +0 -178
- package/src/components/sections/prose/prose.visual.test.tsx +0 -105
- package/src/components/sections/quote-block/index.ts +0 -5
- package/src/components/sections/river/index.ts +0 -1
- package/src/components/sections/river/river.stories.tsx +0 -237
- package/src/components/sections/river/river.test.tsx +0 -268
- package/src/components/sections/tout/index.ts +0 -1
- package/src/components/sections/tout/tout.stories.tsx +0 -171
- package/src/components/sections/tout/tout.test.tsx +0 -242
- package/src/components/sections/two-column-section/index.ts +0 -5
- package/src/components/sections/two-column-section/two-column-section.stories.tsx +0 -285
- package/src/components/shared/index.ts +0 -5
- package/src/index.ts +0 -293
- package/src/main.tsx +0 -13
- package/src/stories/grid-system.stories.tsx +0 -309
- package/src/stories/introduction.mdx +0 -128
- package/src/stories/theme-provider.stories.tsx +0 -349
- package/src/stories/token-showcase.stories.tsx +0 -73
- package/src/stories/token-showcase.tsx +0 -777
- package/src/styles.css +0 -14
- package/src/tests/token-resolution.test.tsx +0 -298
- package/src/theme/theme-provider.test.tsx +0 -270
|
@@ -1,185 +0,0 @@
|
|
|
1
|
-
import { describe, expect, test } from "vitest";
|
|
2
|
-
import { page } from "vitest/browser";
|
|
3
|
-
import { render } from "vitest-browser-react";
|
|
4
|
-
import { Banner } from "./banner";
|
|
5
|
-
|
|
6
|
-
describe("Banner", () => {
|
|
7
|
-
describe("Accessibility", () => {
|
|
8
|
-
test("renders as section landmark", async () => {
|
|
9
|
-
render(
|
|
10
|
-
<Banner
|
|
11
|
-
heading="Test Banner"
|
|
12
|
-
description="Test description"
|
|
13
|
-
data-testid="banner"
|
|
14
|
-
/>,
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const banner = page.getByTestId("banner");
|
|
18
|
-
await expect.element(banner).toBeInTheDocument();
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test("heading renders as h2", async () => {
|
|
22
|
-
render(
|
|
23
|
-
<Banner heading="Banner Heading" description="Test description" />,
|
|
24
|
-
);
|
|
25
|
-
|
|
26
|
-
await expect
|
|
27
|
-
.element(
|
|
28
|
-
page.getByRole("heading", { level: 2, name: "Banner Heading" }),
|
|
29
|
-
)
|
|
30
|
-
.toBeInTheDocument();
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test("description is accessible to screen readers", async () => {
|
|
34
|
-
render(
|
|
35
|
-
<Banner heading="Test" description="Accessible description text" />,
|
|
36
|
-
);
|
|
37
|
-
|
|
38
|
-
await expect
|
|
39
|
-
.element(page.getByText("Accessible description text"))
|
|
40
|
-
.toBeInTheDocument();
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
describe("Props", () => {
|
|
45
|
-
test("renders with required heading and description props", async () => {
|
|
46
|
-
render(
|
|
47
|
-
<Banner
|
|
48
|
-
heading="Required Heading"
|
|
49
|
-
description="Required description"
|
|
50
|
-
/>,
|
|
51
|
-
);
|
|
52
|
-
|
|
53
|
-
await expect
|
|
54
|
-
.element(page.getByText("Required Heading"))
|
|
55
|
-
.toBeInTheDocument();
|
|
56
|
-
await expect
|
|
57
|
-
.element(page.getByText("Required description"))
|
|
58
|
-
.toBeInTheDocument();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
test("renders action when provided", async () => {
|
|
62
|
-
render(
|
|
63
|
-
<Banner
|
|
64
|
-
heading="With Action"
|
|
65
|
-
description="Description"
|
|
66
|
-
action={<button type="button">Click Me</button>}
|
|
67
|
-
/>,
|
|
68
|
-
);
|
|
69
|
-
|
|
70
|
-
await expect
|
|
71
|
-
.element(page.getByRole("button", { name: "Click Me" }))
|
|
72
|
-
.toBeInTheDocument();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
test("does not render action slot when not provided", async () => {
|
|
76
|
-
render(
|
|
77
|
-
<Banner
|
|
78
|
-
heading="Without Action"
|
|
79
|
-
description="Description"
|
|
80
|
-
data-testid="banner"
|
|
81
|
-
/>,
|
|
82
|
-
);
|
|
83
|
-
|
|
84
|
-
const banner = page.getByTestId("banner");
|
|
85
|
-
await expect.element(banner).toBeInTheDocument();
|
|
86
|
-
// Only heading and description should be present
|
|
87
|
-
await expect.element(page.getByRole("button")).not.toBeInTheDocument();
|
|
88
|
-
});
|
|
89
|
-
|
|
90
|
-
test("supports custom className", async () => {
|
|
91
|
-
render(
|
|
92
|
-
<Banner
|
|
93
|
-
heading="Custom"
|
|
94
|
-
description="Description"
|
|
95
|
-
className="custom-class"
|
|
96
|
-
data-testid="banner"
|
|
97
|
-
/>,
|
|
98
|
-
);
|
|
99
|
-
|
|
100
|
-
const banner = page.getByTestId("banner");
|
|
101
|
-
await expect.element(banner).toHaveClass(/custom-class/);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
test("spreads additional props to section element", async () => {
|
|
105
|
-
render(
|
|
106
|
-
<Banner
|
|
107
|
-
heading="Props Test"
|
|
108
|
-
description="Description"
|
|
109
|
-
data-testid="banner"
|
|
110
|
-
aria-label="Banner section"
|
|
111
|
-
/>,
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
const banner = page.getByTestId("banner");
|
|
115
|
-
await expect
|
|
116
|
-
.element(banner)
|
|
117
|
-
.toHaveAttribute("aria-label", "Banner section");
|
|
118
|
-
});
|
|
119
|
-
});
|
|
120
|
-
|
|
121
|
-
describe("Styling", () => {
|
|
122
|
-
test("applies default background color", async () => {
|
|
123
|
-
render(
|
|
124
|
-
<Banner
|
|
125
|
-
heading="Default"
|
|
126
|
-
description="Description"
|
|
127
|
-
data-testid="banner"
|
|
128
|
-
/>,
|
|
129
|
-
);
|
|
130
|
-
|
|
131
|
-
const banner = page.getByTestId("banner");
|
|
132
|
-
await expect.element(banner).toHaveClass(/bg-gray-50/);
|
|
133
|
-
});
|
|
134
|
-
|
|
135
|
-
test("applies col-full for grid alignment", async () => {
|
|
136
|
-
render(
|
|
137
|
-
<Banner
|
|
138
|
-
heading="Grid Test"
|
|
139
|
-
description="Description"
|
|
140
|
-
data-testid="banner"
|
|
141
|
-
/>,
|
|
142
|
-
);
|
|
143
|
-
|
|
144
|
-
const banner = page.getByTestId("banner");
|
|
145
|
-
await expect.element(banner).toHaveClass(/col-full/);
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
test("applies responsive padding classes", async () => {
|
|
149
|
-
render(
|
|
150
|
-
<Banner
|
|
151
|
-
heading="Responsive"
|
|
152
|
-
description="Description"
|
|
153
|
-
data-testid="banner"
|
|
154
|
-
/>,
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
const banner = page.getByTestId("banner");
|
|
158
|
-
// Mobile padding
|
|
159
|
-
await expect.element(banner).toHaveClass(/px-20/);
|
|
160
|
-
await expect.element(banner).toHaveClass(/py-32/);
|
|
161
|
-
});
|
|
162
|
-
});
|
|
163
|
-
|
|
164
|
-
describe("Content", () => {
|
|
165
|
-
test("heading has correct text color", async () => {
|
|
166
|
-
render(<Banner heading="Styled Heading" description="Description" />);
|
|
167
|
-
|
|
168
|
-
const heading = page.getByRole("heading", { level: 2 });
|
|
169
|
-
await expect.element(heading).toHaveClass(/text-gray-900/);
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
test("description has correct text color", async () => {
|
|
173
|
-
render(
|
|
174
|
-
<Banner
|
|
175
|
-
heading="Test"
|
|
176
|
-
description="Styled description"
|
|
177
|
-
data-testid="banner"
|
|
178
|
-
/>,
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
const description = page.getByText("Styled description");
|
|
182
|
-
await expect.element(description).toHaveClass(/text-gray-800/);
|
|
183
|
-
});
|
|
184
|
-
});
|
|
185
|
-
});
|
|
@@ -1,351 +0,0 @@
|
|
|
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
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { CardGrid, type CardGridProps, cardGridVariants } from "./card-grid";
|