This repository has been archived by the owner on Aug 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
field.stories.tsx
executable file
·112 lines (108 loc) · 2.96 KB
/
field.stories.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
import { Meta, Story } from '@storybook/react';
import React from 'react';
import { withDesign } from 'storybook-addon-designs';
import { Container, mapArgTypes } from '../../stories';
import {
Field as Component,
FieldHint,
FieldLabel,
FieldMessage,
FieldMessageProps,
FieldText,
} from '../field';
import { Grid } from '../grid';
import { Icon } from '../icon';
import { Input } from '../input';
export default {
title: 'Components/Form/Field',
component: FieldMessage,
decorators: [
(Story) => (
<>
<Grid columns="repeat(2, 1fr)" gap="24px">
<Story />
</Grid>
</>
),
withDesign,
],
parameters: {
design: {
type: 'figma',
url: 'https://www.figma.com/file/rEhCUlh0IRFrtoFeIK5kEt/Design-System-2?node-id=16%3A998',
},
},
args: {},
argTypes: {
...mapArgTypes(['align', 'as', 'block', 'children', 'direction', 'gap', 'justify', 'wrap'], {
control: { disable: true },
table: { disable: true },
}),
...mapArgTypes(['theme'], {
control: { type: 'inline-radio' },
}),
'data-qa': {
control: 'text',
description: 'QA handle',
table: {
type: { summary: 'string' },
// eslint-disable-next-line no-template-curly-in-string
defaultValue: { summary: 'field-message-${theme}' },
},
},
},
} as Meta;
const Template: Story<FieldMessageProps> = (args) => (
<>
<Container indent="24px" resize="both" size="300px">
<Component>
<FieldLabel>
Label
<FieldHint text="Optional" />
<Icon name="QuestionCircle" size="xs" />
</FieldLabel>
<FieldText>Text to explain what this action might do to your story</FieldText>
<Input
placeholder="Hold my 🍺"
leader={
<>
<Icon name="Search" />
</>
}
trailer={
<>
<Icon name="TimesCircle" />
</>
}
/>
<FieldText>Additional tip, hint or explanation</FieldText>
<FieldMessage {...args}>And here comes a feedback message!</FieldMessage>
</Component>
</Container>
<Container indent="24px" resize="both" size="300px">
<Component>
<FieldLabel>
Really really really looooooooooooooong label
<Icon name="QuestionCircle" size="xs" />
</FieldLabel>
<FieldText>Text to explain what this action might do to your story</FieldText>
<Input
placeholder="Hold my 🍺"
leader={
<>
<Icon name="Search" />
</>
}
trailer={
<>
<Icon name="TimesCircle" />
</>
}
/>
<FieldText secondary>Secondary additional tip, hint or explanation</FieldText>
<FieldMessage {...args}>And here comes a feedback message!</FieldMessage>
</Component>
</Container>
</>
);
export const Field = Template.bind({});