Skip to content

Commit

Permalink
update modal stories
Browse files Browse the repository at this point in the history
  • Loading branch information
wolverineks committed Jul 24, 2021
1 parent 8de859d commit 3dfe98a
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 37 deletions.
23 changes: 12 additions & 11 deletions src/components/Common/DangerousActionModal.stories.js
@@ -1,23 +1,27 @@
// @flow

import React, {useState} from 'react'

import React from 'react'
import {Text} from '../UiKit'
import {storiesOf} from '@storybook/react-native'

import {withModalProps} from '../../../storybook/decorators'
import DangerousActionModal from './DangerousActionModal'

const Modal = () => {
const [visible, setIsVisible] = useState(true)
return (
storiesOf('DangerousActionModal', module)
.addDecorator(withModalProps)
.add('Default', ({visible, onPress, onRequestClose}) => (
<DangerousActionModal
visible={visible}
onRequestClose={() => setIsVisible(false)}
onRequestClose={onRequestClose}
showCloseIcon
title="Attention"
primaryButton={{
label: 'Cancel',
onPress: () => setIsVisible(false),
onPress: () => onPress('primary'),
}}
secondaryButton={{
label: 'Cancel',
onPress: () => onPress('secondary'),
}}
alertBox={{
content: [
Expand All @@ -34,7 +38,4 @@ const Modal = () => {
qui officia deserunt mollit anim id est laborum.
</Text>
</DangerousActionModal>
)
}

storiesOf('DangerousAction', module).add('As modal', () => <Modal />)
))
23 changes: 12 additions & 11 deletions src/components/Ledger/LedgerTransportSwitchModal.stories.js
Expand Up @@ -2,17 +2,18 @@

import React from 'react'
import {storiesOf} from '@storybook/react-native'
import {action} from '@storybook/addon-actions'
import StorybookModalWrapper from '../Common/StorybookModalWrapper'

import {withModalProps} from '../../../storybook/decorators'
import LedgerTransportSwitchModal from './LedgerTransportSwitchModal'

const StatefulModal = StorybookModalWrapper(LedgerTransportSwitchModal)

storiesOf('Ledger Transport Switch Modal', module).add('default', () => (
<StatefulModal
onPress={() => action('clicked')()}
onSelectUSB={() => action('USB selected')()}
onSelectBLE={() => action('BLE selected')()}
/>
))
storiesOf('Ledger Transport Switch Modal', module)
.addDecorator(withModalProps)
.add('default', ({visible, onRequestClose, onPress}) => (
<LedgerTransportSwitchModal
visible={visible}
showCloseIcon
onRequestClose={onRequestClose}
onSelectUSB={onPress('USB selected')}
onSelectBLE={onPress('BLE selected')}
/>
))
@@ -1,23 +1,14 @@
// @flow

import React from 'react'
import {compose} from 'redux'
import {withStateHandlers} from 'recompose'

import {storiesOf} from '@storybook/react-native'

import MnemonicExplanationModal from './MnemonicExplanationModal'
import {withModalProps} from '../../../../storybook/decorators'

const ModalWrapper = compose(
withStateHandlers(
{
visible: true,
},
{
onRequestClose: () => () => ({visible: false}),
onConfirm: () => () => ({visible: false}),
},
),
)(MnemonicExplanationModal)

storiesOf('MnemonicExplanationModal', module).add('Default', () => <ModalWrapper />)
storiesOf('MnemonicExplanationModal', module)
.addDecorator(withModalProps)
.add('Default', ({visible, onPress, onRequestClose}) => (
<MnemonicExplanationModal visible={visible} onConfirm={onPress('onConfirm')} onRequestClose={onRequestClose} />
))

0 comments on commit 3dfe98a

Please sign in to comment.