mirror of
https://github.com/owncast/owncast.git
synced 2024-12-19 07:44:26 +03:00
6fa576a04a
* feat: close modal after name change * refactor: shortened modal name * fix: added a no-op for NameChangeModal storybook
41 lines
1,015 B
TypeScript
41 lines
1,015 B
TypeScript
import React, { useEffect } from 'react';
|
|
import { ComponentStory, ComponentMeta } from '@storybook/react';
|
|
import { RecoilRoot, useSetRecoilState } from 'recoil';
|
|
import { NameChangeModal } from './NameChangeModal';
|
|
import { CurrentUser } from '../../../interfaces/current-user';
|
|
import { currentUserAtom } from '../../stores/ClientConfigStore';
|
|
|
|
export default {
|
|
title: 'owncast/Modals/Name Change',
|
|
component: NameChangeModal,
|
|
parameters: {},
|
|
} as ComponentMeta<typeof NameChangeModal>;
|
|
|
|
const Example = () => {
|
|
const setCurrentUser = useSetRecoilState<CurrentUser>(currentUserAtom);
|
|
|
|
useEffect(
|
|
() =>
|
|
setCurrentUser({
|
|
id: '1',
|
|
displayName: 'Test User',
|
|
displayColor: 3,
|
|
isModerator: false,
|
|
}),
|
|
[],
|
|
);
|
|
|
|
return (
|
|
<div>
|
|
<NameChangeModal closeModal={() => {}} />
|
|
</div>
|
|
);
|
|
};
|
|
|
|
const Template: ComponentStory<typeof NameChangeModal> = () => (
|
|
<RecoilRoot>
|
|
<Example />
|
|
</RecoilRoot>
|
|
);
|
|
|
|
export const Basic = Template.bind({});
|