import React, { useState } from 'react'; import { Meta, Story } from '@storybook/react'; import I18nWrapper from '../../I18nWrapper'; import AuthWidget, { Props } from './Auth'; import './Auth.css'; const meta: Meta = { title: 'Auth Widget', component: AuthWidget, argTypes: { pwdOrTokens: { control: { type: 'select', options: ['password', 'tokens'], }, }, showTokens: { control: { type: 'boolean', }, }, }, parameters: { controls: { expanded: true }, }, }; export default meta; const Template: Story = args => { const [pwdOrTokens, setPwdOrTokens] = useState( args.pwdOrTokens as 'password' | 'tokens' | null ); return ( ); }; const TemplateWithModal: Story = args => { const [pwdOrTokens, setPwdOrTokens] = useState( args.pwdOrTokens as 'password' | 'tokens' | null ); return ( ); }; export const Password = Template.bind({}); Password.args = { pwdOrTokens: 'password', minimumNumberOfRecoveryTokens: 2, showTokens: false, }; export const WithTokens = Template.bind({}); WithTokens.args = { pwdOrTokens: 'password', minimumNumberOfRecoveryTokens: 2, showTokens: true, }; export const Tokens = Template.bind({}); Tokens.args = { pwdOrTokens: 'tokens', minimumNumberOfRecoveryTokens: 2, showTokens: true, }; export const WithModal = TemplateWithModal.bind({}); WithModal.args = { pwdOrTokens: 'password', minimumNumberOfRecoveryTokens: 2, showTokens: true, };