Skip to content

Commit

Permalink
Adds generated stories for Chat Avatar (#2333)
Browse files Browse the repository at this point in the history
* adds LiveExample & generated stories

* Create nervous-suits-thank.md

* disable snapshot
  • Loading branch information
TheSonOfThomp authored and stephl3 committed May 21, 2024
1 parent 126331f commit 65f35b6
Show file tree
Hide file tree
Showing 2 changed files with 65 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/nervous-suits-thank.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@lg-chat/avatar': patch
---

Adds Generated stories
70 changes: 60 additions & 10 deletions chat/avatar/src/Avatar.stories.tsx
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: {},
};

0 comments on commit 65f35b6

Please sign in to comment.