@buildcanada/components 0.3.4 → 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/package.json +3 -2
- package/src/assets/fonts/financier-text-regular.woff2 +0 -0
- package/src/assets/fonts/founders-grotesk-mono-regular.woff2 +0 -0
- package/src/assets/fonts/soehne-kraftig.woff2 +0 -0
- package/src/content/Card/Card.scss +281 -0
- package/src/content/Card/Card.stories.tsx +389 -0
- package/src/content/Card/Card.tsx +170 -0
- package/src/content/Card/index.ts +22 -0
- package/src/content/Hero/Hero.scss +150 -0
- package/src/content/Hero/Hero.stories.tsx +299 -0
- package/src/content/Hero/Hero.tsx +63 -0
- package/src/content/Hero/index.ts +13 -0
- package/src/content/StatBlock/StatBlock.scss +83 -0
- package/src/content/StatBlock/StatBlock.stories.tsx +331 -0
- package/src/content/StatBlock/StatBlock.tsx +52 -0
- package/src/content/StatBlock/index.ts +2 -0
- package/src/feedback/Dialog/Dialog.scss +158 -0
- package/src/feedback/Dialog/Dialog.stories.tsx +286 -0
- package/src/feedback/Dialog/Dialog.tsx +120 -0
- package/src/feedback/Dialog/index.ts +1 -0
- package/src/feedback/PopupForm/PopupForm.scss +34 -0
- package/src/feedback/PopupForm/PopupForm.stories.tsx +341 -0
- package/src/feedback/PopupForm/PopupForm.tsx +90 -0
- package/src/feedback/PopupForm/index.ts +1 -0
- package/src/index.ts +61 -0
- package/src/layout/Container/Container.scss +40 -0
- package/src/layout/Container/Container.stories.tsx +153 -0
- package/src/layout/Container/Container.tsx +29 -0
- package/src/layout/Container/index.ts +2 -0
- package/src/layout/Divider/Divider.scss +117 -0
- package/src/layout/Divider/Divider.stories.tsx +204 -0
- package/src/layout/Divider/Divider.tsx +32 -0
- package/src/layout/Divider/index.ts +2 -0
- package/src/layout/Grid/Grid.scss +81 -0
- package/src/layout/Grid/Grid.stories.tsx +263 -0
- package/src/layout/Grid/Grid.tsx +75 -0
- package/src/layout/Grid/index.ts +2 -0
- package/src/layout/Section/Section.scss +74 -0
- package/src/layout/Section/Section.stories.tsx +173 -0
- package/src/layout/Section/Section.tsx +37 -0
- package/src/layout/Section/index.ts +2 -0
- package/src/layout/Stack/Stack.scss +61 -0
- package/src/layout/Stack/Stack.stories.tsx +342 -0
- package/src/layout/Stack/Stack.tsx +48 -0
- package/src/layout/Stack/index.ts +9 -0
- package/src/navigation/Footer/Footer.scss +233 -0
- package/src/navigation/Footer/Footer.stories.tsx +351 -0
- package/src/navigation/Footer/Footer.tsx +174 -0
- package/src/navigation/Footer/index.ts +2 -0
- package/src/navigation/Header/Header.scss +325 -0
- package/src/navigation/Header/Header.stories.tsx +346 -0
- package/src/navigation/Header/Header.tsx +185 -0
- package/src/navigation/Header/index.ts +2 -0
- package/src/primitives/Button/Button.scss +218 -0
- package/src/primitives/Button/Button.stories.tsx +300 -0
- package/src/primitives/Button/Button.tsx +120 -0
- package/src/primitives/Button/index.ts +2 -0
- package/src/primitives/Checkbox/Checkbox.scss +114 -0
- package/src/primitives/Checkbox/Checkbox.stories.tsx +204 -0
- package/src/primitives/Checkbox/Checkbox.tsx +75 -0
- package/src/primitives/Checkbox/index.ts +2 -0
- package/src/primitives/TextField/TextField.scss +93 -0
- package/src/primitives/TextField/TextField.stories.tsx +265 -0
- package/src/primitives/TextField/TextField.tsx +105 -0
- package/src/primitives/TextField/index.ts +2 -0
- package/src/styles/fonts.scss +27 -0
- package/src/styles/main.scss +36 -0
- package/src/styles/tokens.scss +301 -0
- package/src/styles/typography.scss +232 -0
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import cx from "classnames"
|
|
2
|
+
|
|
3
|
+
export type GridColumns = 1 | 2 | 3 | 4 | 6 | 12
|
|
4
|
+
export type GridGap = "none" | "sm" | "md" | "lg"
|
|
5
|
+
|
|
6
|
+
export interface GridProps {
|
|
7
|
+
children: React.ReactNode
|
|
8
|
+
className?: string
|
|
9
|
+
style?: React.CSSProperties
|
|
10
|
+
columns?: GridColumns
|
|
11
|
+
columnsMd?: GridColumns
|
|
12
|
+
columnsLg?: GridColumns
|
|
13
|
+
gap?: GridGap
|
|
14
|
+
as?: "div" | "ul" | "ol"
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export function Grid({
|
|
18
|
+
children,
|
|
19
|
+
className,
|
|
20
|
+
style,
|
|
21
|
+
columns = 1,
|
|
22
|
+
columnsMd,
|
|
23
|
+
columnsLg,
|
|
24
|
+
gap = "md",
|
|
25
|
+
as: Component = "div",
|
|
26
|
+
}: GridProps) {
|
|
27
|
+
const classes = cx(
|
|
28
|
+
"bc-grid",
|
|
29
|
+
`bc-grid--cols-${columns}`,
|
|
30
|
+
`bc-grid--gap-${gap}`,
|
|
31
|
+
columnsMd && `bc-grid--cols-md-${columnsMd}`,
|
|
32
|
+
columnsLg && `bc-grid--cols-lg-${columnsLg}`,
|
|
33
|
+
className
|
|
34
|
+
)
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<Component className={classes} style={style}>
|
|
38
|
+
{children}
|
|
39
|
+
</Component>
|
|
40
|
+
)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
export interface GridItemProps {
|
|
44
|
+
children: React.ReactNode
|
|
45
|
+
className?: string
|
|
46
|
+
style?: React.CSSProperties
|
|
47
|
+
span?: number
|
|
48
|
+
spanMd?: number
|
|
49
|
+
spanLg?: number
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export function GridItem({
|
|
53
|
+
children,
|
|
54
|
+
className,
|
|
55
|
+
style,
|
|
56
|
+
span,
|
|
57
|
+
spanMd,
|
|
58
|
+
spanLg,
|
|
59
|
+
}: GridItemProps) {
|
|
60
|
+
const classes = cx(
|
|
61
|
+
"bc-grid__item",
|
|
62
|
+
span && `bc-grid__item--span-${span}`,
|
|
63
|
+
spanMd && `bc-grid__item--span-md-${spanMd}`,
|
|
64
|
+
spanLg && `bc-grid__item--span-lg-${spanLg}`,
|
|
65
|
+
className
|
|
66
|
+
)
|
|
67
|
+
|
|
68
|
+
return (
|
|
69
|
+
<div className={classes} style={style}>
|
|
70
|
+
{children}
|
|
71
|
+
</div>
|
|
72
|
+
)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default Grid
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
@use "../../styles/tokens" as *;
|
|
2
|
+
|
|
3
|
+
/*******************************************************************************
|
|
4
|
+
* Section Component
|
|
5
|
+
*
|
|
6
|
+
* Full-width section with background color variants
|
|
7
|
+
******************************************************************************/
|
|
8
|
+
|
|
9
|
+
.bc-section {
|
|
10
|
+
width: 100%;
|
|
11
|
+
|
|
12
|
+
/***************************************************************************
|
|
13
|
+
* Background Variants
|
|
14
|
+
***************************************************************************/
|
|
15
|
+
|
|
16
|
+
&--bg-white {
|
|
17
|
+
background-color: $white;
|
|
18
|
+
color: $text-primary;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&--bg-linen {
|
|
22
|
+
background-color: $linen;
|
|
23
|
+
color: $text-primary;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
&--bg-charcoal {
|
|
27
|
+
background-color: $charcoal;
|
|
28
|
+
color: $text-inverse;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/***************************************************************************
|
|
32
|
+
* Spacing Variants
|
|
33
|
+
***************************************************************************/
|
|
34
|
+
|
|
35
|
+
&--spacing-none {
|
|
36
|
+
padding-top: 0;
|
|
37
|
+
padding-bottom: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
&--spacing-sm {
|
|
41
|
+
padding-top: $space-4;
|
|
42
|
+
padding-bottom: $space-4;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
&--spacing-md {
|
|
46
|
+
padding-top: $space-6;
|
|
47
|
+
padding-bottom: $space-6;
|
|
48
|
+
|
|
49
|
+
@include md-up {
|
|
50
|
+
padding-top: $space-8;
|
|
51
|
+
padding-bottom: $space-8;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
&--spacing-lg {
|
|
56
|
+
padding-top: $space-8;
|
|
57
|
+
padding-bottom: $space-8;
|
|
58
|
+
|
|
59
|
+
@include md-up {
|
|
60
|
+
padding-top: $space-10;
|
|
61
|
+
padding-bottom: $space-10;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
&--spacing-xl {
|
|
66
|
+
padding-top: $space-10;
|
|
67
|
+
padding-bottom: $space-10;
|
|
68
|
+
|
|
69
|
+
@include md-up {
|
|
70
|
+
padding-top: $space-12;
|
|
71
|
+
padding-bottom: $space-12;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -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
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import cx from "classnames"
|
|
2
|
+
|
|
3
|
+
export type SectionBackground = "white" | "linen" | "charcoal"
|
|
4
|
+
export type SectionSpacing = "none" | "sm" | "md" | "lg" | "xl"
|
|
5
|
+
|
|
6
|
+
export interface SectionProps {
|
|
7
|
+
children: React.ReactNode
|
|
8
|
+
className?: string
|
|
9
|
+
style?: React.CSSProperties
|
|
10
|
+
background?: SectionBackground
|
|
11
|
+
spacing?: SectionSpacing
|
|
12
|
+
id?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export function Section({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
style,
|
|
19
|
+
background = "white",
|
|
20
|
+
spacing = "lg",
|
|
21
|
+
id,
|
|
22
|
+
}: SectionProps) {
|
|
23
|
+
const classes = cx(
|
|
24
|
+
"bc-section",
|
|
25
|
+
`bc-section--bg-${background}`,
|
|
26
|
+
`bc-section--spacing-${spacing}`,
|
|
27
|
+
className
|
|
28
|
+
)
|
|
29
|
+
|
|
30
|
+
return (
|
|
31
|
+
<section className={classes} style={style} id={id}>
|
|
32
|
+
{children}
|
|
33
|
+
</section>
|
|
34
|
+
)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export default Section
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
@use "../../styles/tokens" as *;
|
|
2
|
+
|
|
3
|
+
/*******************************************************************************
|
|
4
|
+
* Stack Component
|
|
5
|
+
*
|
|
6
|
+
* Flexbox-based layout for consistent spacing
|
|
7
|
+
******************************************************************************/
|
|
8
|
+
|
|
9
|
+
.bc-stack {
|
|
10
|
+
display: flex;
|
|
11
|
+
|
|
12
|
+
/***************************************************************************
|
|
13
|
+
* Direction Variants
|
|
14
|
+
***************************************************************************/
|
|
15
|
+
|
|
16
|
+
&--vertical {
|
|
17
|
+
flex-direction: column;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
&--horizontal {
|
|
21
|
+
flex-direction: row;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/***************************************************************************
|
|
25
|
+
* Spacing Variants
|
|
26
|
+
***************************************************************************/
|
|
27
|
+
|
|
28
|
+
&--spacing-none { gap: 0; }
|
|
29
|
+
&--spacing-xs { gap: calc($space-1 / 2); }
|
|
30
|
+
&--spacing-sm { gap: $space-1; }
|
|
31
|
+
&--spacing-md { gap: $space-2; }
|
|
32
|
+
&--spacing-lg { gap: $space-3; }
|
|
33
|
+
&--spacing-xl { gap: $space-4; }
|
|
34
|
+
|
|
35
|
+
/***************************************************************************
|
|
36
|
+
* Alignment Variants
|
|
37
|
+
***************************************************************************/
|
|
38
|
+
|
|
39
|
+
&--align-start { align-items: flex-start; }
|
|
40
|
+
&--align-center { align-items: center; }
|
|
41
|
+
&--align-end { align-items: flex-end; }
|
|
42
|
+
&--align-stretch { align-items: stretch; }
|
|
43
|
+
|
|
44
|
+
/***************************************************************************
|
|
45
|
+
* Justify Variants
|
|
46
|
+
***************************************************************************/
|
|
47
|
+
|
|
48
|
+
&--justify-start { justify-content: flex-start; }
|
|
49
|
+
&--justify-center { justify-content: center; }
|
|
50
|
+
&--justify-end { justify-content: flex-end; }
|
|
51
|
+
&--justify-between { justify-content: space-between; }
|
|
52
|
+
&--justify-around { justify-content: space-around; }
|
|
53
|
+
|
|
54
|
+
/***************************************************************************
|
|
55
|
+
* Wrap
|
|
56
|
+
***************************************************************************/
|
|
57
|
+
|
|
58
|
+
&--wrap {
|
|
59
|
+
flex-wrap: wrap;
|
|
60
|
+
}
|
|
61
|
+
}
|