From 7eeeb7cc6166b436fbe041e0375e5ab224f458e5 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Fri, 31 Jul 2020 23:11:26 +0300 Subject: [PATCH] Some auth storybooks progress [skip ci] --- packages/app/components/auth/Auth.story.tsx | 30 +++++++++++++++++++ .../auth/acceptRules/AcceptRules.story.tsx | 8 +++++ .../auth/activation/Activation.story.tsx | 9 ++++++ .../chooseAccount/ChooseAccount.story.tsx | 10 +++++++ 4 files changed, 57 insertions(+) create mode 100644 packages/app/components/auth/Auth.story.tsx create mode 100644 packages/app/components/auth/acceptRules/AcceptRules.story.tsx create mode 100644 packages/app/components/auth/activation/Activation.story.tsx create mode 100644 packages/app/components/auth/chooseAccount/ChooseAccount.story.tsx diff --git a/packages/app/components/auth/Auth.story.tsx b/packages/app/components/auth/Auth.story.tsx new file mode 100644 index 0000000..573679e --- /dev/null +++ b/packages/app/components/auth/Auth.story.tsx @@ -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 = ({ factory }) => { + const { Title, Body, Footer, Links } = factory(); + const history = useHistory(); + const location = useLocation(); + const match = useRouteMatch(); + + return ( +
+ } + Body={} + Footer={
} + Links={} + // TODO: inject actions, when PanelTransition become a pure component + // resolve={action('resolve')} + // reject={action('reject')} + /> +
+ ); +}; diff --git a/packages/app/components/auth/acceptRules/AcceptRules.story.tsx b/packages/app/components/auth/acceptRules/AcceptRules.story.tsx new file mode 100644 index 0000000..b432f87 --- /dev/null +++ b/packages/app/components/auth/acceptRules/AcceptRules.story.tsx @@ -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', () => ); diff --git a/packages/app/components/auth/activation/Activation.story.tsx b/packages/app/components/auth/activation/Activation.story.tsx new file mode 100644 index 0000000..c31f321 --- /dev/null +++ b/packages/app/components/auth/activation/Activation.story.tsx @@ -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', () => ); diff --git a/packages/app/components/auth/chooseAccount/ChooseAccount.story.tsx b/packages/app/components/auth/chooseAccount/ChooseAccount.story.tsx new file mode 100644 index 0000000..eea91a9 --- /dev/null +++ b/packages/app/components/auth/chooseAccount/ChooseAccount.story.tsx @@ -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', () => );