diff --git a/apps/vr-tests-react-components/src/stories/Avatar.stories.tsx b/apps/vr-tests-react-components/src/stories/Avatar.stories.tsx index 5345c5135a46ef..81ad178a35a167 100644 --- a/apps/vr-tests-react-components/src/stories/Avatar.stories.tsx +++ b/apps/vr-tests-react-components/src/stories/Avatar.stories.tsx @@ -1,9 +1,10 @@ -import { storiesOf } from '@storybook/react'; +import type { Meta, StoryFn } from '@storybook/react'; import * as React from 'react'; import { Steps, StoryWright } from 'storywright'; import { Avatar, AvatarProps } from '@fluentui/react-avatar'; import { tokens } from '@fluentui/react-theme'; import { PeopleRegular, PersonCallRegular } from '@fluentui/react-icons'; +import { DARK_MODE, HIGH_CONTRAST, RTL, getStoryVariant } from '../utilities'; const imageRoot = 'http://fabricweb.azureedge.net/fabric-website/assets/images/avatar'; @@ -185,81 +186,101 @@ const AvatarColors: React.FC> = ); }; -storiesOf('Avatar Converged', module) - .addDecorator(story => ( -
-
- {story()} -
-
- )) - .addDecorator(story => ( - {story()} - )) - .addStory( - 'basic', - () => ( -
- - - - - } /> - } shape="square" /> - } shape="square" /> - - +export default { + title: 'Avatar Converged', + component: Avatar, + decorators: [ + story => ( +
+
+ {story()} +
), - { includeRtl: true, includeHighContrast: true, includeDarkMode: true }, - ) - .addStory('size+name', () => ) - .addStory('size+icon+badge+square', () => ) - .addStory('size+image+badge', () => ) - .addStory('size+inactive+badge', () => ( - - )) - - /* Temporarily disable these stories as these cause noise with storywright - The issue is raised against playwright. Till it gets fixed we disabled these. https://github.com/microsoft/playwright/issues/18373 - .addStory('size+active+badge', () => ( - - )) - .addStory('size+active+shadow', () => ( - - )) - .addStory('size+active+ring-shadow', () => ( - - ))*/ - .addStory( - 'badgeMask', - () => ( -
- -
+ story => ( + {story()} ), - { includeRtl: true }, - ) - .addStory('customSize+image', () => ) - .addStory('customSize+name+badge', () => ( - - )) - .addStory('customSize+icon+active', () => ) - .addStory('color', () => , { - includeHighContrast: true, - includeDarkMode: true, - }) - .addStory('color+active', () => , { - includeHighContrast: true, - includeDarkMode: true, - }) - .addStory('image-bad-url', () => ) - .addStory('image-bad-url+icon', () => ); + ], +} satisfies Meta; + +type Story = StoryFn; + +export const Basic: Story = () => ( +
+ + + + + } /> + } shape="square" /> + } shape="square" /> + + +
+); +Basic.storyName = 'basic'; + +export const BasicRTL = getStoryVariant(Basic, RTL); +export const BasicDarkMode = getStoryVariant(Basic, DARK_MODE); +export const BasicHighContrast = getStoryVariant(Basic, HIGH_CONTRAST); + +export const SizeName: Story = () => ; +SizeName.storyName = 'size+name'; + +export const SizeIconBadgeSquare: Story = () => ; +SizeIconBadgeSquare.storyName = 'size+icon+badge+square'; + +export const SizeImageBadge: Story = () => ; +SizeImageBadge.storyName = 'size+image+badge'; + +export const SizeInactiveBadge: Story = () => ( + +); +SizeInactiveBadge.storyName = 'size+inactive+badge'; + +export const BadgeMask: Story = () => ( +
+ +
+); +BadgeMask.storyName = 'badgeMask'; + +export const BadgeMaskRTL = getStoryVariant(BadgeMask, RTL); + +export const CustomSizeImage: Story = () => ; +CustomSizeImage.storyName = 'customSize+image'; + +export const CustomSizeNameBadge: Story = () => ( + +); +CustomSizeNameBadge.storyName = 'customSize+name+badge'; + +export const CustomSizeIconActive: Story = () => ( + +); +CustomSizeIconActive.storyName = 'customSize+icon+active'; + +export const Color: Story = () => ; +Color.storyName = 'color'; + +export const ColorHighContrast = getStoryVariant(Color, HIGH_CONTRAST); +export const ColorDarkMode = getStoryVariant(Color, DARK_MODE); + +export const ColorActive: Story = () => ; +ColorActive.storyName = 'color+active'; + +export const ColorActiveHighContrast = getStoryVariant(ColorActive, HIGH_CONTRAST); +export const ColorActiveDarkMode = getStoryVariant(ColorActive, DARK_MODE); + +export const ImageBadUrl: Story = () => ( + +); +ImageBadUrl.storyName = 'image-bad-url'; + +export const ImageBadUrlIcon: Story = () => ; +ImageBadUrlIcon.storyName = 'image-bad-url+icon';