0
owncast/web/components/common/UserDropdown/UserDropdown.stories.tsx
kame 4f078e1ee4
Migrated Storybook notation from CSF2 to CSF3 (#3412)
* Migrate web action-buttons directory to CSF3 notation

* Migrate web chat directory to CSF3 notation

* Migrate web common directory to CSF3 notation

* Migrate web layout directory to CSF3 notation

* Migrate web modals directory to CSF3 notation

* Migrate web ui directory to CSF3 notation

* Migrate web video directory to CSF3 notation

* Migrate web stories directory to CSF3 notation
2023-11-06 19:35:05 -08:00

47 lines
1.1 KiB
TypeScript

import { useEffect } from 'react';
import { StoryFn, Meta } from '@storybook/react';
import { RecoilRoot, useSetRecoilState } from 'recoil';
import { UserDropdown } from './UserDropdown';
import { CurrentUser } from '../../../interfaces/current-user';
import { currentUserAtom } from '../../stores/ClientConfigStore';
const meta = {
title: 'owncast/Components/User settings menu',
component: UserDropdown,
parameters: {},
} satisfies Meta<typeof UserDropdown>;
export default meta;
// This component uses Recoil internally so wrap it in a RecoilRoot.
const Example = args => {
const setCurrentUser = useSetRecoilState<CurrentUser>(currentUserAtom);
useEffect(
() =>
setCurrentUser({
id: '1',
displayName: 'Test User',
displayColor: 3,
isModerator: false,
}),
[],
);
return <UserDropdown id="user-menu" {...args} />;
};
const Template: StoryFn<typeof UserDropdown> = args => (
<RecoilRoot>
<Example {...args} />
</RecoilRoot>
);
export const ChatEnabled = {
render: Template,
args: {
username: 'test-user',
},
};