-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds generated stories for Chat Avatar (#2333)
* adds LiveExample & generated stories * Create nervous-suits-thank.md * disable snapshot
- Loading branch information
1 parent
126331f
commit 65f35b6
Showing
2 changed files
with
65 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@lg-chat/avatar': patch | ||
--- | ||
|
||
Adds Generated stories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,74 @@ | ||
import React from 'react'; | ||
import { LeafyGreenChatProvider } from '@lg-chat/leafygreen-chat-provider'; | ||
import { storybookArgTypes } from '@lg-tools/storybook-utils'; | ||
import { StoryFn } from '@storybook/react'; | ||
import { storybookArgTypes, StoryMetaType } from '@lg-tools/storybook-utils'; | ||
import { StoryObj } from '@storybook/react'; | ||
|
||
import { Avatar } from '.'; | ||
import { Avatar, Size, Variant } from '.'; | ||
|
||
export default { | ||
title: 'Chat/Avatar', | ||
component: Avatar, | ||
decorators: [ | ||
StoryFn => <LeafyGreenChatProvider>{StoryFn()}</LeafyGreenChatProvider>, | ||
], | ||
parameters: { | ||
default: 'LiveExample', | ||
generate: { | ||
storyNames: ['DefaultVariant', 'MongoVariant', 'UserVariant'], | ||
combineArgs: { | ||
darkMode: [false, true], | ||
size: Object.values(Size), | ||
sizeOverride: [undefined, 56], | ||
}, | ||
excludeCombinations: [ | ||
{ | ||
sizeOverride: 56, | ||
size: Size.Small, | ||
}, | ||
], | ||
}, | ||
}, | ||
argTypes: { | ||
darkMode: storybookArgTypes.darkMode, | ||
variant: { | ||
control: 'select', | ||
options: Variant, | ||
}, | ||
name: { control: 'text' }, | ||
size: { | ||
control: 'select', | ||
options: Size, | ||
}, | ||
sizeOverride: { control: 'number' }, | ||
}, | ||
}; | ||
} satisfies StoryMetaType<typeof Avatar>; | ||
|
||
const Template: StoryFn<typeof Avatar> = props => ( | ||
<LeafyGreenChatProvider> | ||
<Avatar {...props} /> | ||
</LeafyGreenChatProvider> | ||
); | ||
export const LiveExample: StoryObj<typeof Avatar> = { | ||
render: props => <Avatar {...props} />, | ||
parameters: { | ||
chromatic: { | ||
disableSnapshot: true, | ||
}, | ||
}, | ||
}; | ||
|
||
export const Basic: StoryFn<typeof Avatar> = Template.bind({}); | ||
export const DefaultVariant: StoryObj<typeof Avatar> = { | ||
render: props => <Avatar {...props} />, | ||
args: { | ||
variant: Variant.Default, | ||
}, | ||
}; | ||
export const MongoVariant: StoryObj<typeof Avatar> = { | ||
render: props => <Avatar {...props} />, | ||
args: { | ||
variant: Variant.Mongo, | ||
}, | ||
}; | ||
export const UserVariant: StoryObj<typeof Avatar> = { | ||
render: props => <Avatar {...props} />, | ||
args: { | ||
variant: Variant.User, | ||
name: 'Maisie Williams', | ||
}, | ||
parameters: {}, | ||
}; |