mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-11-26 16:52:06 +05:30
Some auth storybooks progress [skip ci]
This commit is contained in:
parent
3cff6ad26c
commit
7eeeb7cc61
30
packages/app/components/auth/Auth.story.tsx
Normal file
30
packages/app/components/auth/Auth.story.tsx
Normal file
@ -0,0 +1,30 @@
|
||||
import React, { ComponentType } from 'react';
|
||||
import { useHistory, useLocation, useRouteMatch } from 'react-router';
|
||||
|
||||
import { Factory } from './factory';
|
||||
import PanelTransition from './PanelTransition';
|
||||
|
||||
interface AuthPresenterProps {
|
||||
factory: Factory;
|
||||
}
|
||||
|
||||
export const AuthPresenter: ComponentType<AuthPresenterProps> = ({ factory }) => {
|
||||
const { Title, Body, Footer, Links } = factory();
|
||||
const history = useHistory();
|
||||
const location = useLocation();
|
||||
const match = useRouteMatch();
|
||||
|
||||
return (
|
||||
<div style={{ maxWidth: '340px', padding: '55px 50px', textAlign: 'center' }}>
|
||||
<PanelTransition
|
||||
Title={<Title />}
|
||||
Body={<Body history={history} location={location} match={match} />}
|
||||
Footer={<Footer />}
|
||||
Links={<Links />}
|
||||
// TODO: inject actions, when PanelTransition become a pure component
|
||||
// resolve={action('resolve')}
|
||||
// reject={action('reject')}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
};
|
@ -0,0 +1,8 @@
|
||||
import React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
|
||||
import { AuthPresenter } from 'app/components/auth/Auth.story';
|
||||
|
||||
import AcceptRules from './AcceptRules';
|
||||
|
||||
storiesOf('Components/Auth', module).add('AcceptRules', () => <AuthPresenter factory={AcceptRules} />);
|
@ -0,0 +1,9 @@
|
||||
import React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
|
||||
import { AuthPresenter } from 'app/components/auth/Auth.story';
|
||||
|
||||
import Activation from './Activation';
|
||||
|
||||
// TODO: add case with provided key
|
||||
storiesOf('Components/Auth', module).add('Activation', () => <AuthPresenter factory={Activation} />);
|
@ -0,0 +1,10 @@
|
||||
import React from 'react';
|
||||
import { storiesOf } from '@storybook/react';
|
||||
|
||||
import { AuthPresenter } from 'app/components/auth/Auth.story';
|
||||
|
||||
import ChooseAccount from './ChooseAccount';
|
||||
|
||||
// TODO: provide accounts list
|
||||
// TODO: provide application name
|
||||
storiesOf('Components/Auth', module).add('ChooseAccount', () => <AuthPresenter factory={ChooseAccount} />);
|
Loading…
Reference in New Issue
Block a user