2022-11-07 02:33:21 +03:00
|
|
|
import React, { useEffect } from 'react';
|
2022-05-14 01:07:49 +03:00
|
|
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
2022-11-07 02:33:21 +03:00
|
|
|
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
2022-09-07 10:00:28 +03:00
|
|
|
import { NameChangeModal } from './NameChangeModal';
|
2022-11-07 02:33:21 +03:00
|
|
|
import { CurrentUser } from '../../../interfaces/current-user';
|
|
|
|
import { currentUserAtom } from '../../stores/ClientConfigStore';
|
2022-05-14 01:07:49 +03:00
|
|
|
|
|
|
|
export default {
|
2022-11-07 02:33:21 +03:00
|
|
|
title: 'owncast/Modals/Name Change',
|
2022-05-14 01:07:49 +03:00
|
|
|
component: NameChangeModal,
|
|
|
|
parameters: {},
|
|
|
|
} as ComponentMeta<typeof NameChangeModal>;
|
|
|
|
|
2022-11-07 02:33:21 +03:00
|
|
|
const Example = () => {
|
|
|
|
const setCurrentUser = useSetRecoilState<CurrentUser>(currentUserAtom);
|
|
|
|
|
|
|
|
useEffect(
|
|
|
|
() =>
|
|
|
|
setCurrentUser({
|
|
|
|
id: '1',
|
|
|
|
displayName: 'Test User',
|
|
|
|
displayColor: 3,
|
|
|
|
isModerator: false,
|
|
|
|
}),
|
|
|
|
[],
|
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<div>
|
2023-06-13 08:54:12 +03:00
|
|
|
<NameChangeModal closeModal={() => {}} />
|
2022-11-07 02:33:21 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
const Template: ComponentStory<typeof NameChangeModal> = () => (
|
2022-05-26 23:52:04 +03:00
|
|
|
<RecoilRoot>
|
2022-11-07 02:33:21 +03:00
|
|
|
<Example />
|
2022-05-26 23:52:04 +03:00
|
|
|
</RecoilRoot>
|
|
|
|
);
|
2022-05-14 01:07:49 +03:00
|
|
|
|
|
|
|
export const Basic = Template.bind({});
|