@buildcanada/components 0.3.3 → 0.3.5
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/dist/content/Card/Card.d.ts +62 -0
- package/dist/content/Card/Card.d.ts.map +1 -0
- package/dist/content/Card/Card.js +45 -0
- package/dist/content/Card/Card.scss +281 -0
- package/dist/content/Card/index.d.ts +3 -0
- package/dist/content/Card/index.d.ts.map +1 -0
- package/dist/content/Card/index.js +2 -0
- package/dist/content/Hero/Hero.d.ts +28 -0
- package/dist/content/Hero/Hero.d.ts.map +1 -0
- package/dist/content/Hero/Hero.js +16 -0
- package/dist/content/Hero/Hero.scss +150 -0
- package/dist/content/Hero/index.d.ts +3 -0
- package/dist/content/Hero/index.d.ts.map +1 -0
- package/dist/content/Hero/index.js +2 -0
- package/dist/content/StatBlock/StatBlock.d.ts +15 -0
- package/dist/content/StatBlock/StatBlock.d.ts.map +1 -0
- package/dist/content/StatBlock/StatBlock.js +10 -0
- package/dist/content/StatBlock/StatBlock.scss +83 -0
- package/dist/content/StatBlock/index.d.ts +3 -0
- package/dist/content/StatBlock/index.d.ts.map +1 -0
- package/dist/content/StatBlock/index.js +2 -0
- package/dist/feedback/Dialog/Dialog.d.ts +18 -0
- package/dist/feedback/Dialog/Dialog.d.ts.map +1 -0
- package/dist/feedback/Dialog/Dialog.js +33 -0
- package/dist/feedback/Dialog/Dialog.scss +158 -0
- package/dist/feedback/Dialog/index.d.ts +2 -0
- package/dist/feedback/Dialog/index.d.ts.map +1 -0
- package/dist/feedback/Dialog/index.js +1 -0
- package/dist/feedback/PopupForm/PopupForm.d.ts +24 -0
- package/dist/feedback/PopupForm/PopupForm.d.ts.map +1 -0
- package/dist/feedback/PopupForm/PopupForm.js +13 -0
- package/dist/feedback/PopupForm/PopupForm.scss +34 -0
- package/dist/feedback/PopupForm/index.d.ts +2 -0
- package/dist/feedback/PopupForm/index.d.ts.map +1 -0
- package/dist/feedback/PopupForm/index.js +1 -0
- package/dist/index.d.ts +21 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/layout/Container/Container.d.ts +11 -0
- package/dist/layout/Container/Container.d.ts.map +1 -0
- package/dist/layout/Container/Container.js +7 -0
- package/dist/layout/Container/Container.scss +40 -0
- package/dist/layout/Container/index.d.ts +3 -0
- package/dist/layout/Container/index.d.ts.map +1 -0
- package/dist/layout/Container/index.js +2 -0
- package/dist/layout/Divider/Divider.d.ts +12 -0
- package/dist/layout/Divider/Divider.d.ts.map +1 -0
- package/dist/layout/Divider/Divider.js +7 -0
- package/dist/layout/Divider/Divider.scss +117 -0
- package/dist/layout/Divider/index.d.ts +3 -0
- package/dist/layout/Divider/index.d.ts.map +1 -0
- package/dist/layout/Divider/index.js +2 -0
- package/dist/layout/Grid/Grid.d.ts +24 -0
- package/dist/layout/Grid/Grid.d.ts.map +1 -0
- package/dist/layout/Grid/Grid.js +11 -0
- package/dist/layout/Grid/Grid.scss +81 -0
- package/dist/layout/Grid/index.d.ts +3 -0
- package/dist/layout/Grid/index.d.ts.map +1 -0
- package/dist/layout/Grid/index.js +2 -0
- package/dist/layout/Section/Section.d.ts +13 -0
- package/dist/layout/Section/Section.d.ts.map +1 -0
- package/dist/layout/Section/Section.js +7 -0
- package/dist/layout/Section/Section.scss +74 -0
- package/dist/layout/Section/index.d.ts +3 -0
- package/dist/layout/Section/index.d.ts.map +1 -0
- package/dist/layout/Section/index.js +2 -0
- package/dist/layout/Stack/Stack.d.ts +18 -0
- package/dist/layout/Stack/Stack.d.ts.map +1 -0
- package/dist/layout/Stack/Stack.js +7 -0
- package/dist/layout/Stack/Stack.scss +61 -0
- package/dist/layout/Stack/index.d.ts +3 -0
- package/dist/layout/Stack/index.d.ts.map +1 -0
- package/dist/layout/Stack/index.js +2 -0
- package/dist/navigation/Footer/Footer.d.ts +31 -0
- package/dist/navigation/Footer/Footer.d.ts.map +1 -0
- package/dist/navigation/Footer/Footer.js +21 -0
- package/dist/navigation/Footer/Footer.scss +233 -0
- package/dist/navigation/Footer/index.d.ts +3 -0
- package/dist/navigation/Footer/index.d.ts.map +1 -0
- package/dist/navigation/Footer/index.js +2 -0
- package/dist/navigation/Header/Header.d.ts +23 -0
- package/dist/navigation/Header/Header.d.ts.map +1 -0
- package/dist/navigation/Header/Header.js +16 -0
- package/dist/navigation/Header/Header.scss +325 -0
- package/dist/navigation/Header/index.d.ts +3 -0
- package/dist/navigation/Header/index.d.ts.map +1 -0
- package/dist/navigation/Header/index.js +2 -0
- package/dist/primitives/Button/Button.d.ts +31 -0
- package/dist/primitives/Button/Button.d.ts.map +1 -0
- package/dist/primitives/Button/Button.js +36 -0
- package/dist/primitives/Button/Button.scss +218 -0
- package/dist/primitives/Button/index.d.ts +3 -0
- package/dist/primitives/Button/index.d.ts.map +1 -0
- package/dist/primitives/Button/index.js +2 -0
- package/dist/primitives/Checkbox/Checkbox.d.ts +13 -0
- package/dist/primitives/Checkbox/Checkbox.d.ts.map +1 -0
- package/dist/primitives/Checkbox/Checkbox.js +10 -0
- package/dist/primitives/Checkbox/Checkbox.scss +114 -0
- package/dist/primitives/Checkbox/index.d.ts +3 -0
- package/dist/primitives/Checkbox/index.d.ts.map +1 -0
- package/dist/primitives/Checkbox/index.js +2 -0
- package/dist/primitives/TextField/TextField.d.ts +22 -0
- package/dist/primitives/TextField/TextField.d.ts.map +1 -0
- package/dist/primitives/TextField/TextField.js +14 -0
- package/dist/primitives/TextField/TextField.scss +93 -0
- package/dist/primitives/TextField/index.d.ts +3 -0
- package/dist/primitives/TextField/index.d.ts.map +1 -0
- package/dist/primitives/TextField/index.js +2 -0
- package/dist/styles/fonts.scss +27 -0
- package/dist/styles/main.scss +36 -0
- package/dist/styles/tokens.scss +301 -0
- package/dist/styles/typography.scss +232 -0
- package/package.json +12 -11
- package/src/content/Card/Card.stories.tsx +389 -0
- package/src/content/Card/index.ts +2 -2
- package/src/content/Hero/Hero.stories.tsx +299 -0
- package/src/content/Hero/index.ts +2 -2
- package/src/content/StatBlock/StatBlock.stories.tsx +331 -0
- package/src/content/StatBlock/index.ts +2 -2
- package/src/feedback/Dialog/Dialog.stories.tsx +286 -0
- package/src/feedback/Dialog/index.ts +1 -1
- package/src/feedback/PopupForm/PopupForm.stories.tsx +341 -0
- package/src/feedback/PopupForm/PopupForm.tsx +2 -2
- package/src/feedback/PopupForm/index.ts +1 -1
- package/src/index.ts +15 -15
- package/src/layout/Container/Container.stories.tsx +153 -0
- package/src/layout/Container/index.ts +2 -2
- package/src/layout/Divider/Divider.stories.tsx +204 -0
- package/src/layout/Divider/index.ts +2 -2
- package/src/layout/Grid/Grid.stories.tsx +263 -0
- package/src/layout/Grid/index.ts +2 -2
- package/src/layout/Section/Section.stories.tsx +173 -0
- package/src/layout/Section/index.ts +2 -2
- package/src/layout/Stack/Stack.stories.tsx +342 -0
- package/src/layout/Stack/index.ts +2 -2
- package/src/navigation/Footer/Footer.stories.tsx +351 -0
- package/src/navigation/Footer/index.ts +2 -2
- package/src/navigation/Header/Header.stories.tsx +346 -0
- package/src/navigation/Header/index.ts +2 -2
- package/src/primitives/Button/Button.stories.tsx +300 -0
- package/src/primitives/Button/index.ts +2 -2
- package/src/primitives/Checkbox/Checkbox.stories.tsx +204 -0
- package/src/primitives/Checkbox/index.ts +2 -2
- package/src/primitives/TextField/TextField.stories.tsx +265 -0
- package/src/primitives/TextField/index.ts +2 -2
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { Divider } from "./Divider"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Divider> = {
|
|
6
|
+
title: "Components/Layout/Divider",
|
|
7
|
+
component: Divider,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `
|
|
12
|
+
A visual separator for dividing content sections.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
\`\`\`tsx
|
|
17
|
+
import { Divider } from "@buildcanada/components"
|
|
18
|
+
|
|
19
|
+
<Divider variant="solid" spacing="md" />
|
|
20
|
+
\`\`\`
|
|
21
|
+
|
|
22
|
+
## Variants
|
|
23
|
+
|
|
24
|
+
- **solid**: Standard solid line
|
|
25
|
+
- **dashed**: Dashed line for lighter separation
|
|
26
|
+
- **construction**: Blueprint-style pattern (Build Canada brand)
|
|
27
|
+
|
|
28
|
+
## Vertical Orientation
|
|
29
|
+
|
|
30
|
+
Use \`orientation="vertical"\` for horizontal layouts:
|
|
31
|
+
|
|
32
|
+
\`\`\`tsx
|
|
33
|
+
<div style={{ display: "flex" }}>
|
|
34
|
+
<div>Left</div>
|
|
35
|
+
<Divider orientation="vertical" />
|
|
36
|
+
<div>Right</div>
|
|
37
|
+
</div>
|
|
38
|
+
\`\`\`
|
|
39
|
+
`,
|
|
40
|
+
},
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
argTypes: {
|
|
44
|
+
orientation: {
|
|
45
|
+
control: "radio",
|
|
46
|
+
options: ["horizontal", "vertical"],
|
|
47
|
+
description: "Direction of the divider",
|
|
48
|
+
},
|
|
49
|
+
variant: {
|
|
50
|
+
control: "select",
|
|
51
|
+
options: ["solid", "dashed", "construction"],
|
|
52
|
+
description: "Visual style of the divider",
|
|
53
|
+
},
|
|
54
|
+
spacing: {
|
|
55
|
+
control: "select",
|
|
56
|
+
options: ["none", "sm", "md", "lg"],
|
|
57
|
+
description: "Margin around the divider",
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export default meta
|
|
63
|
+
type Story = StoryObj<typeof Divider>
|
|
64
|
+
|
|
65
|
+
export const Default: Story = {
|
|
66
|
+
args: {
|
|
67
|
+
orientation: "horizontal",
|
|
68
|
+
variant: "solid",
|
|
69
|
+
spacing: "md",
|
|
70
|
+
},
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
export const Solid: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
variant: "solid",
|
|
76
|
+
spacing: "md",
|
|
77
|
+
},
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const Dashed: Story = {
|
|
81
|
+
args: {
|
|
82
|
+
variant: "dashed",
|
|
83
|
+
spacing: "md",
|
|
84
|
+
},
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export const Construction: Story = {
|
|
88
|
+
args: {
|
|
89
|
+
variant: "construction",
|
|
90
|
+
spacing: "md",
|
|
91
|
+
},
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export const NoSpacing: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
variant: "solid",
|
|
97
|
+
spacing: "none",
|
|
98
|
+
},
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
export const SmallSpacing: Story = {
|
|
102
|
+
args: {
|
|
103
|
+
variant: "solid",
|
|
104
|
+
spacing: "sm",
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const LargeSpacing: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
variant: "solid",
|
|
111
|
+
spacing: "lg",
|
|
112
|
+
},
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const Vertical: Story = {
|
|
116
|
+
args: {
|
|
117
|
+
orientation: "vertical",
|
|
118
|
+
variant: "solid",
|
|
119
|
+
spacing: "md",
|
|
120
|
+
},
|
|
121
|
+
decorators: [
|
|
122
|
+
(Story) => (
|
|
123
|
+
<div style={{ display: "flex", height: "100px", alignItems: "stretch" }}>
|
|
124
|
+
<div style={{ padding: "16px", fontFamily: "sans-serif" }}>Left Content</div>
|
|
125
|
+
<Story />
|
|
126
|
+
<div style={{ padding: "16px", fontFamily: "sans-serif" }}>Right Content</div>
|
|
127
|
+
</div>
|
|
128
|
+
),
|
|
129
|
+
],
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const VerticalDashed: Story = {
|
|
133
|
+
args: {
|
|
134
|
+
orientation: "vertical",
|
|
135
|
+
variant: "dashed",
|
|
136
|
+
spacing: "md",
|
|
137
|
+
},
|
|
138
|
+
decorators: [
|
|
139
|
+
(Story) => (
|
|
140
|
+
<div style={{ display: "flex", height: "100px", alignItems: "stretch" }}>
|
|
141
|
+
<div style={{ padding: "16px", fontFamily: "sans-serif" }}>Left</div>
|
|
142
|
+
<Story />
|
|
143
|
+
<div style={{ padding: "16px", fontFamily: "sans-serif" }}>Right</div>
|
|
144
|
+
</div>
|
|
145
|
+
),
|
|
146
|
+
],
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
export const InContent: Story = {
|
|
150
|
+
render: () => (
|
|
151
|
+
<div style={{ maxWidth: "600px", fontFamily: "sans-serif" }}>
|
|
152
|
+
<h2 style={{ margin: "0 0 8px" }}>Section One</h2>
|
|
153
|
+
<p style={{ margin: "0 0 16px", lineHeight: 1.6 }}>
|
|
154
|
+
This is the first section of content. It contains some text that
|
|
155
|
+
demonstrates how dividers work to separate content.
|
|
156
|
+
</p>
|
|
157
|
+
<Divider variant="solid" spacing="md" />
|
|
158
|
+
<h2 style={{ margin: "0 0 8px" }}>Section Two</h2>
|
|
159
|
+
<p style={{ margin: "0 0 16px", lineHeight: 1.6 }}>
|
|
160
|
+
This is the second section. The solid divider above creates a
|
|
161
|
+
clear visual break between the two sections.
|
|
162
|
+
</p>
|
|
163
|
+
<Divider variant="dashed" spacing="md" />
|
|
164
|
+
<h2 style={{ margin: "0 0 8px" }}>Section Three</h2>
|
|
165
|
+
<p style={{ margin: "0", lineHeight: 1.6 }}>
|
|
166
|
+
The dashed divider provides a lighter separation, suggesting
|
|
167
|
+
related but distinct content.
|
|
168
|
+
</p>
|
|
169
|
+
</div>
|
|
170
|
+
),
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export const ConstructionStyle: Story = {
|
|
174
|
+
render: () => (
|
|
175
|
+
<div style={{ maxWidth: "600px", fontFamily: "sans-serif" }}>
|
|
176
|
+
<h2 style={{ margin: "0 0 16px" }}>Build Canada</h2>
|
|
177
|
+
<Divider variant="construction" spacing="lg" />
|
|
178
|
+
<p style={{ margin: 0, lineHeight: 1.6 }}>
|
|
179
|
+
The construction variant uses the blueprint/draft aesthetic that's
|
|
180
|
+
part of the Build Canada design language. It features a distinctive
|
|
181
|
+
pattern that references technical drawings.
|
|
182
|
+
</p>
|
|
183
|
+
</div>
|
|
184
|
+
),
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export const AllVariants: Story = {
|
|
188
|
+
render: () => (
|
|
189
|
+
<div style={{ display: "flex", flexDirection: "column", gap: "32px", fontFamily: "sans-serif" }}>
|
|
190
|
+
<div>
|
|
191
|
+
<p style={{ marginBottom: "8px" }}>Solid</p>
|
|
192
|
+
<Divider variant="solid" spacing="none" />
|
|
193
|
+
</div>
|
|
194
|
+
<div>
|
|
195
|
+
<p style={{ marginBottom: "8px" }}>Dashed</p>
|
|
196
|
+
<Divider variant="dashed" spacing="none" />
|
|
197
|
+
</div>
|
|
198
|
+
<div>
|
|
199
|
+
<p style={{ marginBottom: "8px" }}>Construction</p>
|
|
200
|
+
<Divider variant="construction" spacing="none" />
|
|
201
|
+
</div>
|
|
202
|
+
</div>
|
|
203
|
+
),
|
|
204
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Divider, type DividerProps, type DividerOrientation, type DividerVariant } from "./Divider"
|
|
2
|
-
export { default } from "./Divider"
|
|
1
|
+
export { Divider, type DividerProps, type DividerOrientation, type DividerVariant } from "./Divider.js"
|
|
2
|
+
export { default } from "./Divider.js"
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { Grid, GridItem } from "./Grid"
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Grid> = {
|
|
6
|
+
title: "Components/Layout/Grid",
|
|
7
|
+
component: Grid,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: `
|
|
12
|
+
A responsive CSS grid layout component with customizable columns and gaps.
|
|
13
|
+
|
|
14
|
+
## Usage
|
|
15
|
+
|
|
16
|
+
\`\`\`tsx
|
|
17
|
+
import { Grid, GridItem } from "@buildcanada/components"
|
|
18
|
+
|
|
19
|
+
<Grid columns={3} gap="md">
|
|
20
|
+
<GridItem>Item 1</GridItem>
|
|
21
|
+
<GridItem>Item 2</GridItem>
|
|
22
|
+
<GridItem span={2}>Wide Item</GridItem>
|
|
23
|
+
</Grid>
|
|
24
|
+
\`\`\`
|
|
25
|
+
|
|
26
|
+
## Responsive Columns
|
|
27
|
+
|
|
28
|
+
Use \`columnsMd\` and \`columnsLg\` props for responsive layouts:
|
|
29
|
+
|
|
30
|
+
\`\`\`tsx
|
|
31
|
+
<Grid columns={1} columnsMd={2} columnsLg={4} gap="md">
|
|
32
|
+
{/* 1 column on mobile, 2 on tablet, 4 on desktop */}
|
|
33
|
+
</Grid>
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
## GridItem Spanning
|
|
37
|
+
|
|
38
|
+
Use \`GridItem\` with the \`span\` prop to make items span multiple columns:
|
|
39
|
+
|
|
40
|
+
\`\`\`tsx
|
|
41
|
+
<Grid columns={12} gap="sm">
|
|
42
|
+
<GridItem span={4}>4 columns</GridItem>
|
|
43
|
+
<GridItem span={8}>8 columns</GridItem>
|
|
44
|
+
</Grid>
|
|
45
|
+
\`\`\`
|
|
46
|
+
`,
|
|
47
|
+
},
|
|
48
|
+
},
|
|
49
|
+
},
|
|
50
|
+
argTypes: {
|
|
51
|
+
columns: {
|
|
52
|
+
control: "select",
|
|
53
|
+
options: [1, 2, 3, 4, 6, 12],
|
|
54
|
+
description: "Number of columns (base/mobile)",
|
|
55
|
+
},
|
|
56
|
+
columnsMd: {
|
|
57
|
+
control: "select",
|
|
58
|
+
options: [undefined, 1, 2, 3, 4, 6, 12],
|
|
59
|
+
description: "Number of columns at medium breakpoint",
|
|
60
|
+
},
|
|
61
|
+
columnsLg: {
|
|
62
|
+
control: "select",
|
|
63
|
+
options: [undefined, 1, 2, 3, 4, 6, 12],
|
|
64
|
+
description: "Number of columns at large breakpoint",
|
|
65
|
+
},
|
|
66
|
+
gap: {
|
|
67
|
+
control: "select",
|
|
68
|
+
options: ["none", "sm", "md", "lg"],
|
|
69
|
+
description: "Gap size between grid items",
|
|
70
|
+
},
|
|
71
|
+
},
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
export default meta
|
|
75
|
+
type Story = StoryObj<typeof Grid>
|
|
76
|
+
|
|
77
|
+
const GridCell = ({ children }: { children: React.ReactNode }) => (
|
|
78
|
+
<div style={{
|
|
79
|
+
padding: "24px",
|
|
80
|
+
backgroundColor: "#F6ECE3",
|
|
81
|
+
border: "1px solid #272727",
|
|
82
|
+
textAlign: "center",
|
|
83
|
+
fontFamily: "sans-serif"
|
|
84
|
+
}}>
|
|
85
|
+
{children}
|
|
86
|
+
</div>
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
export const Default: Story = {
|
|
90
|
+
args: {
|
|
91
|
+
columns: 3,
|
|
92
|
+
gap: "md",
|
|
93
|
+
children: (
|
|
94
|
+
<>
|
|
95
|
+
<GridCell>Item 1</GridCell>
|
|
96
|
+
<GridCell>Item 2</GridCell>
|
|
97
|
+
<GridCell>Item 3</GridCell>
|
|
98
|
+
<GridCell>Item 4</GridCell>
|
|
99
|
+
<GridCell>Item 5</GridCell>
|
|
100
|
+
<GridCell>Item 6</GridCell>
|
|
101
|
+
</>
|
|
102
|
+
),
|
|
103
|
+
},
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export const TwoColumns: Story = {
|
|
107
|
+
args: {
|
|
108
|
+
columns: 2,
|
|
109
|
+
gap: "md",
|
|
110
|
+
children: (
|
|
111
|
+
<>
|
|
112
|
+
<GridCell>Item 1</GridCell>
|
|
113
|
+
<GridCell>Item 2</GridCell>
|
|
114
|
+
<GridCell>Item 3</GridCell>
|
|
115
|
+
<GridCell>Item 4</GridCell>
|
|
116
|
+
</>
|
|
117
|
+
),
|
|
118
|
+
},
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
export const ThreeColumns: Story = {
|
|
122
|
+
args: {
|
|
123
|
+
columns: 3,
|
|
124
|
+
gap: "md",
|
|
125
|
+
children: (
|
|
126
|
+
<>
|
|
127
|
+
<GridCell>Item 1</GridCell>
|
|
128
|
+
<GridCell>Item 2</GridCell>
|
|
129
|
+
<GridCell>Item 3</GridCell>
|
|
130
|
+
</>
|
|
131
|
+
),
|
|
132
|
+
},
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
export const FourColumns: Story = {
|
|
136
|
+
args: {
|
|
137
|
+
columns: 4,
|
|
138
|
+
gap: "md",
|
|
139
|
+
children: (
|
|
140
|
+
<>
|
|
141
|
+
<GridCell>Item 1</GridCell>
|
|
142
|
+
<GridCell>Item 2</GridCell>
|
|
143
|
+
<GridCell>Item 3</GridCell>
|
|
144
|
+
<GridCell>Item 4</GridCell>
|
|
145
|
+
</>
|
|
146
|
+
),
|
|
147
|
+
},
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
export const ResponsiveGrid: Story = {
|
|
151
|
+
args: {
|
|
152
|
+
columns: 1,
|
|
153
|
+
columnsMd: 2,
|
|
154
|
+
columnsLg: 4,
|
|
155
|
+
gap: "md",
|
|
156
|
+
children: (
|
|
157
|
+
<>
|
|
158
|
+
<GridCell>Item 1</GridCell>
|
|
159
|
+
<GridCell>Item 2</GridCell>
|
|
160
|
+
<GridCell>Item 3</GridCell>
|
|
161
|
+
<GridCell>Item 4</GridCell>
|
|
162
|
+
</>
|
|
163
|
+
),
|
|
164
|
+
},
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export const NoGap: Story = {
|
|
168
|
+
args: {
|
|
169
|
+
columns: 3,
|
|
170
|
+
gap: "none",
|
|
171
|
+
children: (
|
|
172
|
+
<>
|
|
173
|
+
<GridCell>Item 1</GridCell>
|
|
174
|
+
<GridCell>Item 2</GridCell>
|
|
175
|
+
<GridCell>Item 3</GridCell>
|
|
176
|
+
</>
|
|
177
|
+
),
|
|
178
|
+
},
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
export const SmallGap: Story = {
|
|
182
|
+
args: {
|
|
183
|
+
columns: 3,
|
|
184
|
+
gap: "sm",
|
|
185
|
+
children: (
|
|
186
|
+
<>
|
|
187
|
+
<GridCell>Item 1</GridCell>
|
|
188
|
+
<GridCell>Item 2</GridCell>
|
|
189
|
+
<GridCell>Item 3</GridCell>
|
|
190
|
+
</>
|
|
191
|
+
),
|
|
192
|
+
},
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export const LargeGap: Story = {
|
|
196
|
+
args: {
|
|
197
|
+
columns: 3,
|
|
198
|
+
gap: "lg",
|
|
199
|
+
children: (
|
|
200
|
+
<>
|
|
201
|
+
<GridCell>Item 1</GridCell>
|
|
202
|
+
<GridCell>Item 2</GridCell>
|
|
203
|
+
<GridCell>Item 3</GridCell>
|
|
204
|
+
</>
|
|
205
|
+
),
|
|
206
|
+
},
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
export const WithGridItems: Story = {
|
|
210
|
+
render: () => (
|
|
211
|
+
<Grid columns={4} gap="md">
|
|
212
|
+
<GridItem span={2}>
|
|
213
|
+
<GridCell>Span 2</GridCell>
|
|
214
|
+
</GridItem>
|
|
215
|
+
<GridItem>
|
|
216
|
+
<GridCell>Span 1</GridCell>
|
|
217
|
+
</GridItem>
|
|
218
|
+
<GridItem>
|
|
219
|
+
<GridCell>Span 1</GridCell>
|
|
220
|
+
</GridItem>
|
|
221
|
+
<GridItem>
|
|
222
|
+
<GridCell>Span 1</GridCell>
|
|
223
|
+
</GridItem>
|
|
224
|
+
<GridItem span={3}>
|
|
225
|
+
<GridCell>Span 3</GridCell>
|
|
226
|
+
</GridItem>
|
|
227
|
+
</Grid>
|
|
228
|
+
),
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
export const TwelveColumnGrid: Story = {
|
|
232
|
+
render: () => (
|
|
233
|
+
<Grid columns={12} gap="sm">
|
|
234
|
+
<GridItem span={4}>
|
|
235
|
+
<GridCell>4 cols</GridCell>
|
|
236
|
+
</GridItem>
|
|
237
|
+
<GridItem span={4}>
|
|
238
|
+
<GridCell>4 cols</GridCell>
|
|
239
|
+
</GridItem>
|
|
240
|
+
<GridItem span={4}>
|
|
241
|
+
<GridCell>4 cols</GridCell>
|
|
242
|
+
</GridItem>
|
|
243
|
+
<GridItem span={6}>
|
|
244
|
+
<GridCell>6 cols</GridCell>
|
|
245
|
+
</GridItem>
|
|
246
|
+
<GridItem span={6}>
|
|
247
|
+
<GridCell>6 cols</GridCell>
|
|
248
|
+
</GridItem>
|
|
249
|
+
<GridItem span={3}>
|
|
250
|
+
<GridCell>3</GridCell>
|
|
251
|
+
</GridItem>
|
|
252
|
+
<GridItem span={3}>
|
|
253
|
+
<GridCell>3</GridCell>
|
|
254
|
+
</GridItem>
|
|
255
|
+
<GridItem span={3}>
|
|
256
|
+
<GridCell>3</GridCell>
|
|
257
|
+
</GridItem>
|
|
258
|
+
<GridItem span={3}>
|
|
259
|
+
<GridCell>3</GridCell>
|
|
260
|
+
</GridItem>
|
|
261
|
+
</Grid>
|
|
262
|
+
),
|
|
263
|
+
}
|
package/src/layout/Grid/index.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Grid, GridItem, type GridProps, type GridItemProps, type GridColumns, type GridGap } from "./Grid"
|
|
2
|
-
export { default } from "./Grid"
|
|
1
|
+
export { Grid, GridItem, type GridProps, type GridItemProps, type GridColumns, type GridGap } from "./Grid.js"
|
|
2
|
+
export { default } from "./Grid.js"
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from "@storybook/react"
|
|
2
|
+
|
|
3
|
+
import { Section } from "./Section"
|
|
4
|
+
import { Container } from "../Container"
|
|
5
|
+
|
|
6
|
+
const meta: Meta<typeof Section> = {
|
|
7
|
+
title: "Components/Layout/Section",
|
|
8
|
+
component: Section,
|
|
9
|
+
parameters: {
|
|
10
|
+
docs: {
|
|
11
|
+
description: {
|
|
12
|
+
component: `
|
|
13
|
+
A full-width section component with background colors and vertical padding.
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
\`\`\`tsx
|
|
18
|
+
import { Section, Container } from "@buildcanada/components"
|
|
19
|
+
|
|
20
|
+
<Section background="linen" spacing="lg">
|
|
21
|
+
<Container>
|
|
22
|
+
<h2>Section Title</h2>
|
|
23
|
+
<p>Section content goes here.</p>
|
|
24
|
+
</Container>
|
|
25
|
+
</Section>
|
|
26
|
+
\`\`\`
|
|
27
|
+
|
|
28
|
+
## Backgrounds
|
|
29
|
+
|
|
30
|
+
- **white**: #FFFFFF
|
|
31
|
+
- **linen**: #F6ECE3 (Build Canada brand)
|
|
32
|
+
- **charcoal**: #272727 (dark mode)
|
|
33
|
+
|
|
34
|
+
## Building Page Layouts
|
|
35
|
+
|
|
36
|
+
Stack sections to create full page layouts:
|
|
37
|
+
|
|
38
|
+
\`\`\`tsx
|
|
39
|
+
<>
|
|
40
|
+
<Section background="linen" spacing="xl">
|
|
41
|
+
<Container><Hero /></Container>
|
|
42
|
+
</Section>
|
|
43
|
+
<Section background="white" spacing="lg">
|
|
44
|
+
<Container><Content /></Container>
|
|
45
|
+
</Section>
|
|
46
|
+
</>
|
|
47
|
+
\`\`\`
|
|
48
|
+
`,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
argTypes: {
|
|
53
|
+
background: {
|
|
54
|
+
control: "select",
|
|
55
|
+
options: ["white", "linen", "charcoal"],
|
|
56
|
+
description: "Background color of the section",
|
|
57
|
+
},
|
|
58
|
+
spacing: {
|
|
59
|
+
control: "select",
|
|
60
|
+
options: ["none", "sm", "md", "lg", "xl"],
|
|
61
|
+
description: "Vertical padding (top and bottom)",
|
|
62
|
+
},
|
|
63
|
+
},
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export default meta
|
|
67
|
+
type Story = StoryObj<typeof Section>
|
|
68
|
+
|
|
69
|
+
const SectionContent = ({ dark = false }: { dark?: boolean }) => (
|
|
70
|
+
<Container>
|
|
71
|
+
<div style={{
|
|
72
|
+
fontFamily: "sans-serif",
|
|
73
|
+
color: dark ? "#ffffff" : "#272727"
|
|
74
|
+
}}>
|
|
75
|
+
<h2 style={{ margin: "0 0 16px" }}>Section Title</h2>
|
|
76
|
+
<p style={{ margin: 0 }}>
|
|
77
|
+
This is example content inside a section. Sections provide consistent
|
|
78
|
+
vertical spacing and background colors for page layouts.
|
|
79
|
+
</p>
|
|
80
|
+
</div>
|
|
81
|
+
</Container>
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
export const Default: Story = {
|
|
85
|
+
args: {
|
|
86
|
+
children: <SectionContent />,
|
|
87
|
+
background: "white",
|
|
88
|
+
spacing: "lg",
|
|
89
|
+
},
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
export const WhiteBackground: Story = {
|
|
93
|
+
args: {
|
|
94
|
+
children: <SectionContent />,
|
|
95
|
+
background: "white",
|
|
96
|
+
spacing: "lg",
|
|
97
|
+
},
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
export const LinenBackground: Story = {
|
|
101
|
+
args: {
|
|
102
|
+
children: <SectionContent />,
|
|
103
|
+
background: "linen",
|
|
104
|
+
spacing: "lg",
|
|
105
|
+
},
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
export const CharcoalBackground: Story = {
|
|
109
|
+
args: {
|
|
110
|
+
children: <SectionContent dark />,
|
|
111
|
+
background: "charcoal",
|
|
112
|
+
spacing: "lg",
|
|
113
|
+
},
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
export const NoSpacing: Story = {
|
|
117
|
+
args: {
|
|
118
|
+
children: <SectionContent />,
|
|
119
|
+
background: "linen",
|
|
120
|
+
spacing: "none",
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const SmallSpacing: Story = {
|
|
125
|
+
args: {
|
|
126
|
+
children: <SectionContent />,
|
|
127
|
+
background: "linen",
|
|
128
|
+
spacing: "sm",
|
|
129
|
+
},
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
export const LargeSpacing: Story = {
|
|
133
|
+
args: {
|
|
134
|
+
children: <SectionContent />,
|
|
135
|
+
background: "linen",
|
|
136
|
+
spacing: "lg",
|
|
137
|
+
},
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export const ExtraLargeSpacing: Story = {
|
|
141
|
+
args: {
|
|
142
|
+
children: <SectionContent />,
|
|
143
|
+
background: "linen",
|
|
144
|
+
spacing: "xl",
|
|
145
|
+
},
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export const StackedSections: Story = {
|
|
149
|
+
render: () => (
|
|
150
|
+
<div>
|
|
151
|
+
<Section background="linen" spacing="lg">
|
|
152
|
+
<Container>
|
|
153
|
+
<h2 style={{ fontFamily: "sans-serif", margin: 0 }}>Linen Section</h2>
|
|
154
|
+
</Container>
|
|
155
|
+
</Section>
|
|
156
|
+
<Section background="white" spacing="lg">
|
|
157
|
+
<Container>
|
|
158
|
+
<h2 style={{ fontFamily: "sans-serif", margin: 0 }}>White Section</h2>
|
|
159
|
+
</Container>
|
|
160
|
+
</Section>
|
|
161
|
+
<Section background="charcoal" spacing="lg">
|
|
162
|
+
<Container>
|
|
163
|
+
<h2 style={{ fontFamily: "sans-serif", margin: 0, color: "#fff" }}>Charcoal Section</h2>
|
|
164
|
+
</Container>
|
|
165
|
+
</Section>
|
|
166
|
+
<Section background="linen" spacing="lg">
|
|
167
|
+
<Container>
|
|
168
|
+
<h2 style={{ fontFamily: "sans-serif", margin: 0 }}>Linen Section</h2>
|
|
169
|
+
</Container>
|
|
170
|
+
</Section>
|
|
171
|
+
</div>
|
|
172
|
+
),
|
|
173
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { Section, type SectionProps, type SectionBackground, type SectionSpacing } from "./Section"
|
|
2
|
-
export { default } from "./Section"
|
|
1
|
+
export { Section, type SectionProps, type SectionBackground, type SectionSpacing } from "./Section.js"
|
|
2
|
+
export { default } from "./Section.js"
|