Skip to content

Commit 9620c0b

Browse files
committed
Update Avatar stories
Remove controls from default, add alternative playground for responsive size, as this prop accepts two different types of data.
1 parent 61daced commit 9620c0b

File tree

1 file changed

+56
-37
lines changed

1 file changed

+56
-37
lines changed

packages/react/src/Avatar/Avatar.stories.tsx

Lines changed: 56 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,65 @@ import placeholderAvatar from '../fixtures/images/avatar-mona.png'
77
export default {
88
title: 'Components/Avatar',
99
component: Avatar,
10-
args: {
11-
size: AvatarSizes[1],
12-
shape: 'circle',
13-
src: placeholderAvatar,
14-
alt: 'A random avatar picture',
15-
},
16-
argTypes: {
17-
size: {
18-
description: 'The size of the Avatar',
19-
control: {
20-
type: 'radio',
21-
options: AvatarSizes,
22-
},
10+
} as Meta<typeof Avatar>
11+
12+
export const Default = () => (
13+
<Avatar src="https://avatars.githubusercontent.com/u/92997159?v=4" alt="A random avatar picture" />
14+
)
15+
16+
export const Playground: StoryFn<typeof Avatar> = args => <Avatar {...args} />
17+
Playground.argTypes = {
18+
shape: {
19+
description: 'The shape of the Avatar',
20+
options: AvatarShapes,
21+
control: {
22+
type: 'radio',
2323
},
24-
shape: {
25-
description: 'The shape of the Avatar',
26-
control: {
27-
type: 'radio',
28-
options: AvatarShapes,
29-
},
24+
},
25+
src: {
26+
description: 'The url of the image to display',
27+
type: {name: 'string', required: true},
28+
control: {
29+
type: 'text',
3030
},
31-
src: {
32-
description: 'The url of the image to display',
33-
type: {name: 'string', required: true},
34-
control: {
35-
type: 'text',
36-
},
31+
},
32+
alt: {
33+
description: 'The alt text for the image',
34+
type: {name: 'string', required: true},
35+
control: {
36+
type: 'text',
3737
},
38-
alt: {
39-
description: 'The alt text for the image',
40-
type: {name: 'string', required: true},
41-
control: {
42-
type: 'text',
43-
},
38+
},
39+
size: {
40+
description: 'The size of the Avatar',
41+
options: AvatarSizes,
42+
control: {
43+
type: 'radio',
4444
},
4545
},
46-
} as Meta<typeof Avatar>
46+
}
47+
Playground.args = {
48+
shape: 'circle',
49+
src: placeholderAvatar,
50+
alt: 'A random avatar picture',
51+
size: AvatarSizes[1],
52+
}
4753

48-
export const Playground: StoryFn<typeof Avatar> = args => <Avatar {...args} />
49-
50-
export const Default = () => (
51-
<Avatar src="https://avatars.githubusercontent.com/u/92997159?v=4" alt="A random avatar picture" />
52-
)
54+
export const Playground2: StoryFn<typeof Avatar> = args => <Avatar {...args} />
55+
Playground2.argTypes = {
56+
...Playground.argTypes,
57+
size: {
58+
control: {
59+
type: 'object',
60+
},
61+
},
62+
}
63+
Playground2.args = {
64+
...Playground.args,
65+
size: {
66+
narrow: AvatarSizes[1],
67+
regular: AvatarSizes[2],
68+
wide: AvatarSizes[3],
69+
},
70+
}
71+
Playground2.storyName = 'Playground (responsive)'

0 commit comments

Comments
 (0)