2022-10-29 08:18:51 +03:00
|
|
|
import React, { useEffect } from 'react';
|
2022-04-28 09:19:20 +03:00
|
|
|
import { ComponentStory, ComponentMeta } 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
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'owncast/Modals/Auth',
|
|
|
|
component: AuthModal,
|
|
|
|
parameters: {},
|
|
|
|
} as ComponentMeta<typeof AuthModal>;
|
|
|
|
|
2022-10-29 08:18:51 +03:00
|
|
|
const Template: ComponentStory<typeof AuthModal> = () => (
|
2022-08-21 02:13:31 +03:00
|
|
|
<RecoilRoot>
|
|
|
|
<Example />
|
|
|
|
</RecoilRoot>
|
|
|
|
);
|
2022-04-28 09:19:20 +03:00
|
|
|
|
|
|
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
|
|
export const Basic = Template.bind({});
|