2023-11-07 06:35:05 +03:00
|
|
|
import { useEffect } from 'react';
|
|
|
|
import { StoryFn, Meta } 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
|
|
|
|
2023-11-07 06:35:05 +03:00
|
|
|
const meta = {
|
2022-11-07 02:33:21 +03:00
|
|
|
title: 'owncast/Modals/Name Change',
|
2022-05-14 01:07:49 +03:00
|
|
|
component: NameChangeModal,
|
|
|
|
parameters: {},
|
2023-11-07 06:35:05 +03:00
|
|
|
} satisfies Meta<typeof NameChangeModal>;
|
|
|
|
|
|
|
|
export default meta;
|
2022-05-14 01:07:49 +03:00
|
|
|
|
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>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2023-11-07 06:35:05 +03:00
|
|
|
const Template: StoryFn<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
|
|
|
|
2023-11-07 06:35:05 +03:00
|
|
|
export const Basic = {
|
|
|
|
render: Template,
|
|
|
|
};
|