2023-11-07 06:35:05 +03:00
|
|
|
import { useEffect } from 'react';
|
|
|
|
import { StoryFn, Meta } from '@storybook/react';
|
2022-10-29 08:18:51 +03:00
|
|
|
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { AuthModal } from './AuthModal';
|
2022-10-29 08:18:51 +03:00
|
|
|
import { currentUserAtom } from '../../stores/ClientConfigStore';
|
|
|
|
import { CurrentUser } from '../../../interfaces/current-user';
|
2022-04-28 09:19:20 +03:00
|
|
|
|
2022-10-29 08:18:51 +03:00
|
|
|
const Example = () => {
|
|
|
|
const setCurrentUser = useSetRecoilState<CurrentUser>(currentUserAtom);
|
|
|
|
|
|
|
|
useEffect(
|
|
|
|
() =>
|
|
|
|
setCurrentUser({
|
|
|
|
id: '1',
|
|
|
|
displayName: 'Test User',
|
|
|
|
displayColor: 3,
|
|
|
|
isModerator: false,
|
|
|
|
}),
|
|
|
|
[],
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2022-12-30 03:26:04 +03:00
|
|
|
<AuthModal forceTabs />
|
2022-10-29 08:18:51 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
2022-04-28 09:19:20 +03:00
|
|
|
|
2023-11-07 06:35:05 +03:00
|
|
|
const meta = {
|
2022-04-28 09:19:20 +03:00
|
|
|
title: 'owncast/Modals/Auth',
|
|
|
|
component: AuthModal,
|
|
|
|
parameters: {},
|
2023-11-07 06:35:05 +03:00
|
|
|
} satisfies Meta<typeof AuthModal>;
|
2022-04-28 09:19:20 +03:00
|
|
|
|
2023-11-07 06:35:05 +03:00
|
|
|
export default meta;
|
|
|
|
|
|
|
|
const Template: StoryFn<typeof AuthModal> = () => (
|
2022-08-21 02:13:31 +03:00
|
|
|
<RecoilRoot>
|
|
|
|
<Example />
|
|
|
|
</RecoilRoot>
|
|
|
|
);
|
2022-04-28 09:19:20 +03:00
|
|
|
|
2023-11-07 06:35:05 +03:00
|
|
|
export const Basic = {
|
|
|
|
render: Template,
|
|
|
|
};
|