@latte-macchiat-io/latte-vanilla-components 0.0.555 → 0.0.557
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 +1 -1
- package/src/components/Actions/stories.tsx +44 -10
- package/src/components/Box/Alert/stories.tsx +44 -14
- package/src/components/Box/stories.tsx +75 -33
- package/src/components/Button/stories.tsx +64 -9
- package/src/components/Button/theme.ts +6 -6
- package/src/components/Carousel/stories.tsx +49 -9
- package/src/components/Columns/stories.tsx +95 -11
- package/src/components/ConsentCookie/stories.tsx +33 -9
- package/src/components/Footer/stories.tsx +50 -8
- package/src/components/Form/Checkbox/styles.css.ts +15 -3
- package/src/components/Form/Select/stories.tsx +42 -36
- package/src/components/Form/TextField/stories.tsx +38 -41
- package/src/components/Header/stories.tsx +44 -9
- package/src/components/Heading/stories.tsx +36 -12
- package/src/components/Icon/stories.tsx +64 -9
- package/src/components/List/stories.tsx +48 -15
- package/src/components/Logo/stories.tsx +24 -6
- package/src/components/Modal/stories.tsx +50 -8
- package/src/components/Nav/stories.tsx +20 -11
- package/src/components/NavLegal/stories.tsx +19 -7
- package/src/components/NavSocial/stories.tsx +46 -8
- package/src/components/Paragraph/stories.tsx +43 -10
- package/src/components/Spacer/stories.tsx +32 -8
- package/src/components/Video/stories.tsx +31 -11
package/package.json
CHANGED
|
@@ -4,31 +4,65 @@ import React from 'react';
|
|
|
4
4
|
import { Button } from '../Button';
|
|
5
5
|
import { Actions } from '.';
|
|
6
6
|
|
|
7
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
8
7
|
const meta: Meta<typeof Actions> = {
|
|
9
8
|
title: '3. Buttons / Actions',
|
|
10
9
|
component: Actions,
|
|
11
10
|
parameters: {
|
|
12
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
13
11
|
layout: 'centered',
|
|
14
12
|
},
|
|
15
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
16
13
|
tags: ['autodocs'],
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
14
|
+
argTypes: {
|
|
15
|
+
align: { control: 'select', options: ['left', 'center', 'right'] },
|
|
16
|
+
direction: { control: 'select', options: ['row', 'column'] },
|
|
17
|
+
},
|
|
18
|
+
decorators: [
|
|
19
|
+
(Story) => (
|
|
20
|
+
<div style={{ width: '400px' }}>
|
|
21
|
+
<Story />
|
|
22
|
+
</div>
|
|
23
|
+
),
|
|
24
|
+
],
|
|
20
25
|
};
|
|
21
26
|
|
|
22
27
|
export default meta;
|
|
23
28
|
type Story = StoryObj<typeof meta>;
|
|
24
29
|
|
|
25
|
-
|
|
26
|
-
|
|
30
|
+
const buttons = (
|
|
31
|
+
<>
|
|
32
|
+
<Button as="button" variant="primary">Primary</Button>
|
|
33
|
+
<Button as="button" variant="secondary">Secondary</Button>
|
|
34
|
+
</>
|
|
35
|
+
);
|
|
36
|
+
|
|
37
|
+
export const AlignLeft: Story = {
|
|
38
|
+
args: { align: 'left', direction: 'row', children: buttons },
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const AlignCenter: Story = {
|
|
42
|
+
args: { align: 'center', direction: 'row', children: buttons },
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
export const AlignRight: Story = {
|
|
46
|
+
args: { align: 'right', direction: 'row', children: buttons },
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const DirectionColumn: Story = {
|
|
50
|
+
args: { align: 'left', direction: 'column', children: buttons },
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const DirectionColumnCenter: Story = {
|
|
54
|
+
args: { align: 'center', direction: 'column', children: buttons },
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const ThreeButtons: Story = {
|
|
27
58
|
args: {
|
|
59
|
+
align: 'center',
|
|
60
|
+
direction: 'row',
|
|
28
61
|
children: (
|
|
29
62
|
<>
|
|
30
|
-
<Button>
|
|
31
|
-
<Button>
|
|
63
|
+
<Button as="button" variant="primary">Primary</Button>
|
|
64
|
+
<Button as="button" variant="secondary">Secondary</Button>
|
|
65
|
+
<Button as="button" variant="tertiary">Tertiary</Button>
|
|
32
66
|
</>
|
|
33
67
|
),
|
|
34
68
|
},
|
|
@@ -24,20 +24,50 @@ const meta: Meta<typeof AlertBox> = {
|
|
|
24
24
|
export default meta;
|
|
25
25
|
type Story = StoryObj<typeof meta>;
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
const content = (
|
|
28
|
+
<>
|
|
29
|
+
<Heading as="h3">Lorem ipsum</Heading>
|
|
30
|
+
<Paragraph>
|
|
31
|
+
<p>
|
|
32
|
+
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim
|
|
33
|
+
veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
|
|
34
|
+
</p>
|
|
35
|
+
</Paragraph>
|
|
36
|
+
</>
|
|
37
|
+
);
|
|
38
|
+
|
|
39
|
+
export const Warning: Story = {
|
|
40
|
+
args: {
|
|
41
|
+
variant: 'warning',
|
|
42
|
+
children: content,
|
|
43
|
+
},
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Info: Story = {
|
|
47
|
+
args: {
|
|
48
|
+
variant: 'info',
|
|
49
|
+
children: content,
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export const Success: Story = {
|
|
54
|
+
args: {
|
|
55
|
+
variant: 'success',
|
|
56
|
+
children: content,
|
|
57
|
+
},
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export const Danger: Story = {
|
|
61
|
+
args: {
|
|
62
|
+
variant: 'danger',
|
|
63
|
+
children: content,
|
|
64
|
+
},
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const WithoutIcon: Story = {
|
|
29
68
|
args: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
<Paragraph>
|
|
34
|
-
<p>
|
|
35
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
|
36
|
-
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
|
37
|
-
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
38
|
-
</p>
|
|
39
|
-
</Paragraph>
|
|
40
|
-
</>
|
|
41
|
-
),
|
|
69
|
+
variant: 'warning',
|
|
70
|
+
noIcon: true,
|
|
71
|
+
children: content,
|
|
42
72
|
},
|
|
43
73
|
};
|
|
@@ -3,44 +3,100 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { Heading } from '../Heading';
|
|
5
5
|
import { Paragraph } from '../Paragraph';
|
|
6
|
-
|
|
7
6
|
import { Box } from '.';
|
|
8
7
|
|
|
9
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
10
8
|
const meta: Meta<typeof Box> = {
|
|
11
9
|
title: '1. Layout/Box/Box',
|
|
12
10
|
component: Box,
|
|
13
11
|
parameters: {
|
|
14
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
15
12
|
layout: 'fullscreen',
|
|
16
13
|
},
|
|
17
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
18
14
|
tags: ['autodocs'],
|
|
19
|
-
// More on argTypes: https://storybook.js.org/docs/api/argtypes
|
|
20
15
|
argTypes: {
|
|
16
|
+
variant: { control: 'select', options: ['primary', 'secondary', 'transparent'] },
|
|
17
|
+
paddingTop: { control: 'select', options: ['small', 'medium', 'large'] },
|
|
18
|
+
align: { control: 'select', options: ['left', 'center', 'right'] },
|
|
19
|
+
vAlign: { control: 'select', options: ['top', 'center', 'bottom', 'spaceBetween'] },
|
|
20
|
+
direction: { control: 'select', options: ['column', 'row'] },
|
|
21
21
|
isLight: { control: 'boolean' },
|
|
22
22
|
isReversed: { control: 'boolean' },
|
|
23
23
|
},
|
|
24
|
-
// Use `fn` to spy on the onClick arg, which will appear in the actions panel once invoked: https://storybook.js.org/docs/essentials/actions#action-args
|
|
25
24
|
};
|
|
26
25
|
|
|
27
26
|
export default meta;
|
|
28
27
|
type Story = StoryObj<typeof meta>;
|
|
29
28
|
|
|
30
|
-
|
|
31
|
-
|
|
29
|
+
const boxContent = (
|
|
30
|
+
<>
|
|
31
|
+
<Heading as="h3">Lorem ipsum</Heading>
|
|
32
|
+
<Paragraph>
|
|
33
|
+
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.</p>
|
|
34
|
+
</Paragraph>
|
|
35
|
+
</>
|
|
36
|
+
);
|
|
37
|
+
|
|
38
|
+
export const Primary: Story = {
|
|
39
|
+
args: { variant: 'primary', children: boxContent },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Secondary: Story = {
|
|
43
|
+
args: { variant: 'secondary', children: boxContent },
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const Transparent: Story = {
|
|
47
|
+
args: { variant: 'transparent', children: boxContent },
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const PaddingSmall: Story = {
|
|
51
|
+
args: { variant: 'primary', paddingTop: 'small', children: boxContent },
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const PaddingMedium: Story = {
|
|
55
|
+
args: { variant: 'primary', paddingTop: 'medium', children: boxContent },
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const PaddingLarge: Story = {
|
|
59
|
+
args: { variant: 'primary', paddingTop: 'large', children: boxContent },
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const AlignCenter: Story = {
|
|
63
|
+
args: { variant: 'primary', align: 'center', children: boxContent },
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const AlignRight: Story = {
|
|
67
|
+
args: { variant: 'primary', align: 'right', children: boxContent },
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
export const VAlignCenter: Story = {
|
|
71
|
+
args: { variant: 'primary', vAlign: 'center', children: boxContent },
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const DirectionRow: Story = {
|
|
32
75
|
args: {
|
|
33
76
|
variant: 'primary',
|
|
77
|
+
direction: 'row',
|
|
78
|
+
children: (
|
|
79
|
+
<>
|
|
80
|
+
<div style={{ flex: 1, background: '#e5e7eb', padding: '1rem', borderRadius: '4px' }}>Left content</div>
|
|
81
|
+
<Paragraph><p>Right content: Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p></Paragraph>
|
|
82
|
+
</>
|
|
83
|
+
),
|
|
84
|
+
},
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
export const IsLight: Story = {
|
|
88
|
+
args: { variant: 'primary', isLight: true, children: boxContent },
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
export const DirectionRowReversed: Story = {
|
|
92
|
+
args: {
|
|
93
|
+
variant: 'secondary',
|
|
94
|
+
direction: 'row',
|
|
95
|
+
isReversed: true,
|
|
34
96
|
children: (
|
|
35
97
|
<>
|
|
36
|
-
<
|
|
37
|
-
<Paragraph>
|
|
38
|
-
<p>
|
|
39
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
|
40
|
-
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
|
41
|
-
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
42
|
-
</p>
|
|
43
|
-
</Paragraph>
|
|
98
|
+
<div style={{ flex: 1, background: '#e5e7eb', padding: '1rem', borderRadius: '4px' }}>First in DOM (shown right)</div>
|
|
99
|
+
<Paragraph><p>Second in DOM (shown left)</p></Paragraph>
|
|
44
100
|
</>
|
|
45
101
|
),
|
|
46
102
|
},
|
|
@@ -51,27 +107,13 @@ export const AdjacentBoxes: Story = {
|
|
|
51
107
|
<>
|
|
52
108
|
<Box {...args}>
|
|
53
109
|
<Heading as="h3">First box</Heading>
|
|
54
|
-
<Paragraph>
|
|
55
|
-
<p>
|
|
56
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
|
57
|
-
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
|
58
|
-
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
59
|
-
</p>
|
|
60
|
-
</Paragraph>
|
|
110
|
+
<Paragraph><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p></Paragraph>
|
|
61
111
|
</Box>
|
|
62
112
|
<Box {...args} variant="secondary">
|
|
63
113
|
<Heading as="h3">Second box</Heading>
|
|
64
|
-
<Paragraph>
|
|
65
|
-
<p>
|
|
66
|
-
Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad
|
|
67
|
-
minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in
|
|
68
|
-
voluptate velit esse cillum dolore eu fugiat nulla pariatur.
|
|
69
|
-
</p>
|
|
70
|
-
</Paragraph>
|
|
114
|
+
<Paragraph><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p></Paragraph>
|
|
71
115
|
</Box>
|
|
72
116
|
</>
|
|
73
117
|
),
|
|
74
|
-
args: {
|
|
75
|
-
variant: 'primary',
|
|
76
|
-
},
|
|
118
|
+
args: { variant: 'primary' },
|
|
77
119
|
};
|
|
@@ -2,27 +2,82 @@ import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
|
2
2
|
|
|
3
3
|
import { Button } from '.';
|
|
4
4
|
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
5
|
const meta: Meta<typeof Button> = {
|
|
7
6
|
title: '3. Buttons / Button',
|
|
8
7
|
component: Button,
|
|
9
8
|
parameters: {
|
|
10
|
-
// Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
|
|
11
9
|
layout: 'centered',
|
|
12
10
|
},
|
|
13
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
14
11
|
tags: ['autodocs'],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
argTypes: {
|
|
13
|
+
variant: { control: 'select', options: ['primary', 'secondary', 'tertiary'] },
|
|
14
|
+
size: { control: 'select', options: ['sm', 'md', 'lg'] },
|
|
15
|
+
style: { control: 'select', options: [undefined, 'outline'] },
|
|
16
|
+
as: { control: 'select', options: ['a', 'button'] },
|
|
17
|
+
fullWidth: { control: 'boolean' },
|
|
18
|
+
isPending: { control: 'boolean' },
|
|
19
|
+
isDisabled: { control: 'boolean' },
|
|
20
|
+
},
|
|
18
21
|
};
|
|
19
22
|
|
|
20
23
|
export default meta;
|
|
21
24
|
type Story = StoryObj<typeof meta>;
|
|
22
25
|
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
export const Primary: Story = {
|
|
27
|
+
args: { children: 'Primary', variant: 'primary', size: 'md', as: 'button' },
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export const Secondary: Story = {
|
|
31
|
+
args: { children: 'Secondary', variant: 'secondary', size: 'md', as: 'button' },
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
export const Tertiary: Story = {
|
|
35
|
+
args: { children: 'Tertiary', variant: 'tertiary', size: 'md', as: 'button' },
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const OutlinePrimary: Story = {
|
|
39
|
+
args: { children: 'Outline Primary', variant: 'primary', style: 'outline', as: 'button' },
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const OutlineSecondary: Story = {
|
|
43
|
+
args: { children: 'Outline Secondary', variant: 'secondary', style: 'outline', as: 'button' },
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
export const OutlineTertiary: Story = {
|
|
47
|
+
args: { children: 'Outline Tertiary', variant: 'tertiary', style: 'outline', as: 'button' },
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const SizeSmall: Story = {
|
|
51
|
+
args: { children: 'Small', variant: 'primary', size: 'sm', as: 'button' },
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const SizeMedium: Story = {
|
|
55
|
+
args: { children: 'Medium', variant: 'primary', size: 'md', as: 'button' },
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export const SizeLarge: Story = {
|
|
59
|
+
args: { children: 'Large', variant: 'primary', size: 'lg', as: 'button' },
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const FullWidth: Story = {
|
|
63
|
+
args: { children: 'Full Width', variant: 'primary', fullWidth: true, as: 'button' },
|
|
64
|
+
parameters: { layout: 'padded' },
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export const Disabled: Story = {
|
|
68
|
+
args: { children: 'Disabled', variant: 'primary', isDisabled: true, as: 'button' },
|
|
69
|
+
};
|
|
70
|
+
|
|
71
|
+
export const Pending: Story = {
|
|
25
72
|
args: {
|
|
26
|
-
children: '
|
|
73
|
+
children: 'Submit',
|
|
74
|
+
variant: 'primary',
|
|
75
|
+
isPending: true,
|
|
76
|
+
as: 'button',
|
|
77
|
+
translation: { isPendingLabel: 'Loading...' },
|
|
27
78
|
},
|
|
28
79
|
};
|
|
80
|
+
|
|
81
|
+
export const AsLink: Story = {
|
|
82
|
+
args: { children: 'Link Button', variant: 'primary', as: 'a', href: '#' },
|
|
83
|
+
};
|
|
@@ -120,15 +120,15 @@ export const themeButtonLight = {
|
|
|
120
120
|
|
|
121
121
|
variant: {
|
|
122
122
|
primary: {
|
|
123
|
-
color: '#
|
|
123
|
+
color: '#FFFFFF',
|
|
124
124
|
backgroundColor: '#FF7377',
|
|
125
125
|
},
|
|
126
126
|
secondary: {
|
|
127
|
-
color: '#
|
|
127
|
+
color: '#FFFFFF',
|
|
128
128
|
backgroundColor: '#FF7377',
|
|
129
129
|
},
|
|
130
130
|
tertiary: {
|
|
131
|
-
color: '#
|
|
131
|
+
color: '#FFFFFF',
|
|
132
132
|
backgroundColor: '#FF7377',
|
|
133
133
|
},
|
|
134
134
|
},
|
|
@@ -141,15 +141,15 @@ export const themeButtonDark = {
|
|
|
141
141
|
|
|
142
142
|
variant: {
|
|
143
143
|
primary: {
|
|
144
|
-
color: '#
|
|
144
|
+
color: '#FFFFFF',
|
|
145
145
|
backgroundColor: '#FF7377',
|
|
146
146
|
},
|
|
147
147
|
secondary: {
|
|
148
|
-
color: '#
|
|
148
|
+
color: '#FFFFFF',
|
|
149
149
|
backgroundColor: '#FF7377',
|
|
150
150
|
},
|
|
151
151
|
tertiary: {
|
|
152
|
-
color: '#
|
|
152
|
+
color: '#FFFFFF',
|
|
153
153
|
backgroundColor: '#FF7377',
|
|
154
154
|
},
|
|
155
155
|
},
|
|
@@ -1,26 +1,66 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react-vite';
|
|
2
|
+
import React from 'react';
|
|
2
3
|
|
|
3
4
|
import { Carousel } from '.';
|
|
4
5
|
|
|
5
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
6
6
|
const meta: Meta<typeof Carousel> = {
|
|
7
7
|
title: '7. Interactive / Carousel',
|
|
8
8
|
component: Carousel,
|
|
9
9
|
parameters: {
|
|
10
|
-
|
|
11
|
-
layout: 'centered',
|
|
10
|
+
layout: 'padded',
|
|
12
11
|
},
|
|
13
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
14
12
|
tags: ['autodocs'],
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
argTypes: {
|
|
14
|
+
showBullets: { control: 'boolean' },
|
|
15
|
+
showNavButtons: { control: 'boolean' },
|
|
16
|
+
autoplay: { control: 'boolean' },
|
|
17
|
+
isFullWidth: { control: 'boolean' },
|
|
18
|
+
itemsPerView: { control: 'number' },
|
|
19
|
+
},
|
|
18
20
|
};
|
|
19
21
|
|
|
20
22
|
export default meta;
|
|
21
23
|
type Story = StoryObj<typeof meta>;
|
|
22
24
|
|
|
23
|
-
|
|
25
|
+
const slide = (label: string, color: string) => (
|
|
26
|
+
<div style={{ padding: '2rem', background: color, textAlign: 'center', borderRadius: '8px', minHeight: '160px', display: 'flex', alignItems: 'center', justifyContent: 'center', fontSize: '1.25rem', fontWeight: 600 }}>
|
|
27
|
+
{label}
|
|
28
|
+
</div>
|
|
29
|
+
);
|
|
30
|
+
|
|
31
|
+
const slides = [
|
|
32
|
+
slide('Slide 1', '#dbeafe'),
|
|
33
|
+
slide('Slide 2', '#dcfce7'),
|
|
34
|
+
slide('Slide 3', '#fef9c3'),
|
|
35
|
+
slide('Slide 4', '#fce7f3'),
|
|
36
|
+
slide('Slide 5', '#ede9fe'),
|
|
37
|
+
];
|
|
38
|
+
|
|
24
39
|
export const Default: Story = {
|
|
25
|
-
args: {},
|
|
40
|
+
args: { data: slides },
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const WithNavButtons: Story = {
|
|
44
|
+
args: { data: slides, showNavButtons: true },
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const WithBullets: Story = {
|
|
48
|
+
args: { data: slides, showBullets: true },
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export const WithNavAndBullets: Story = {
|
|
52
|
+
args: { data: slides, showNavButtons: true, showBullets: true },
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
export const Autoplay: Story = {
|
|
56
|
+
args: { data: slides, autoplay: true, autoplayInterval: 2000, showBullets: true },
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const MultipleItemsPerView: Story = {
|
|
60
|
+
name: '3 items per view',
|
|
61
|
+
args: { data: slides, itemsPerView: 3, showNavButtons: true, gap: 16 },
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const FullWidth: Story = {
|
|
65
|
+
args: { data: slides, isFullWidth: true, showNavButtons: true, showBullets: true },
|
|
26
66
|
};
|
|
@@ -3,31 +3,115 @@ import React from 'react';
|
|
|
3
3
|
|
|
4
4
|
import { Columns } from '.';
|
|
5
5
|
|
|
6
|
-
// More on how to set up stories at: https://storybook.js.org/docs/writing-stories#default-export
|
|
7
6
|
const meta: Meta<typeof Columns> = {
|
|
8
7
|
title: '1. Layout / Columns',
|
|
9
8
|
component: Columns,
|
|
10
9
|
parameters: {
|
|
11
|
-
|
|
12
|
-
layout: 'centered',
|
|
10
|
+
layout: 'fullscreen',
|
|
13
11
|
},
|
|
14
|
-
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs
|
|
15
12
|
tags: ['autodocs'],
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
13
|
+
argTypes: {
|
|
14
|
+
align: { control: 'select', options: ['left', 'center', 'right'] },
|
|
15
|
+
vAlign: { control: 'select', options: ['top', 'center', 'bottom', 'stretch'] },
|
|
16
|
+
reverse: { control: 'boolean' },
|
|
17
|
+
},
|
|
18
|
+
decorators: [
|
|
19
|
+
(Story) => (
|
|
20
|
+
<div style={{ padding: '1rem' }}>
|
|
21
|
+
<Story />
|
|
22
|
+
</div>
|
|
23
|
+
),
|
|
24
|
+
],
|
|
19
25
|
};
|
|
20
26
|
|
|
21
27
|
export default meta;
|
|
22
28
|
type Story = StoryObj<typeof meta>;
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
30
|
+
const col = (label: string, height = '80px') => (
|
|
31
|
+
<div style={{ background: '#e5e7eb', padding: '1rem', minHeight: height, display: 'flex', alignItems: 'center', justifyContent: 'center', borderRadius: '4px' }}>
|
|
32
|
+
{label}
|
|
33
|
+
</div>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
export const TwoEqualColumns: Story = {
|
|
37
|
+
args: {
|
|
38
|
+
columns: [1, 1],
|
|
39
|
+
children: <>{col('Column 1')}{col('Column 2')}</>,
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const ThreeEqualColumns: Story = {
|
|
44
|
+
args: {
|
|
45
|
+
columns: [1, 1, 1],
|
|
46
|
+
children: <>{col('Column 1')}{col('Column 2')}{col('Column 3')}</>,
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
export const FourEqualColumns: Story = {
|
|
51
|
+
args: {
|
|
52
|
+
columns: [1, 1, 1, 1],
|
|
53
|
+
children: <>{col('Col 1')}{col('Col 2')}{col('Col 3')}{col('Col 4')}</>,
|
|
54
|
+
},
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const AsymmetricTwoThirds: Story = {
|
|
58
|
+
name: '2/3 + 1/3',
|
|
59
|
+
args: {
|
|
60
|
+
columns: [2, 1],
|
|
61
|
+
children: <>{col('Main content (2/3)')}{col('Sidebar (1/3)')}</>,
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
export const AsymmetricThreeQuarters: Story = {
|
|
66
|
+
name: '3/4 + 1/4',
|
|
67
|
+
args: {
|
|
68
|
+
columns: [3, 1],
|
|
69
|
+
children: <>{col('Main (3/4)')}{col('Side (1/4)')}</>,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export const AlignCenter: Story = {
|
|
74
|
+
args: {
|
|
75
|
+
columns: [1, 1],
|
|
76
|
+
align: 'center',
|
|
77
|
+
children: <>{col('Left')}{col('Right')}</>,
|
|
78
|
+
},
|
|
79
|
+
};
|
|
80
|
+
|
|
81
|
+
export const VAlignCenter: Story = {
|
|
82
|
+
args: {
|
|
83
|
+
columns: [1, 1],
|
|
84
|
+
vAlign: 'center',
|
|
85
|
+
children: (
|
|
86
|
+
<>
|
|
87
|
+
{col('Short', '60px')}
|
|
88
|
+
{col('Taller column with more content', '140px')}
|
|
89
|
+
</>
|
|
90
|
+
),
|
|
91
|
+
},
|
|
92
|
+
};
|
|
93
|
+
|
|
94
|
+
export const VAlignStretch: Story = {
|
|
95
|
+
args: {
|
|
96
|
+
columns: [1, 1],
|
|
97
|
+
vAlign: 'stretch',
|
|
98
|
+
children: (
|
|
99
|
+
<>
|
|
100
|
+
{col('Short', '60px')}
|
|
101
|
+
{col('Taller column', '140px')}
|
|
102
|
+
</>
|
|
103
|
+
),
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export const Reversed: Story = {
|
|
26
108
|
args: {
|
|
109
|
+
columns: [2, 1],
|
|
110
|
+
reverse: true,
|
|
27
111
|
children: (
|
|
28
112
|
<>
|
|
29
|
-
|
|
30
|
-
|
|
113
|
+
{col('First in DOM (shown right)')}
|
|
114
|
+
{col('Second in DOM (shown left)')}
|
|
31
115
|
</>
|
|
32
116
|
),
|
|
33
117
|
},
|