Skip to content

Feature/progress #390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add modal stories
Signed-off-by: shmck <shawn.j.mckay@gmail.com>
  • Loading branch information
ShMcK committed Jul 17, 2020
commit 60365ef244105784c6ebddb4978a1a86cedfd02b
42 changes: 42 additions & 0 deletions web-app/src/containers/Tutorial/components/Continue.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import * as React from 'react'
import { Dialog, Message } from '@alifd/next'
import Button from '../../../components/Button'

interface Props {
onContinue(): void
}

const Continue = (props: Props) => {
const [modalState, setModalState] = React.useState<'none' | 'continue'>('none')

const onClose = () => {
setModalState('none')
}

const onOk = () => {
setModalState('continue')
props.onContinue()
return setTimeout(() => {
setModalState('none')
}, 3000)
}

return (
<>
<Button type="primary" size="medium" onClick={() => setModalState('continue')}>
Continue
</Button>
<Dialog
visible={modalState === 'continue'}
onOk={onOk}
onCancel={onClose}
onClose={onClose}
footerActions={['ok', 'cancel']}
>
<Message>Level Complete</Message>
</Dialog>
</>
)
}

export default Continue
2 changes: 1 addition & 1 deletion web-app/src/containers/Tutorial/components/Reset.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Dialog, Message } from '@alifd/next'
import Button from '../../../components/Button'

interface Props {
disabled: boolean
disabled?: boolean
onReset(): void
}

Expand Down
13 changes: 13 additions & 0 deletions web-app/stories/Modals.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { action } from '@storybook/addon-actions'
import { withKnobs } from '@storybook/addon-knobs'
import { storiesOf } from '@storybook/react'
import React from 'react'
import SideBarDecorator from './utils/SideBarDecorator'
import Reset from '../src/containers/Tutorial/components/Reset'
import Continue from '../src/containers/Tutorial/components/Continue'

storiesOf('Modals', module)
.addDecorator(SideBarDecorator)
.addDecorator(withKnobs)
.add('Reset', () => <Reset onReset={action('onReset')} />)
.add('Continue', () => <Continue onContinue={action('onContinue')} />)
7 changes: 0 additions & 7 deletions web-app/stories/Tutorial.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,9 @@ import { withKnobs } from '@storybook/addon-knobs'
import { storiesOf } from '@storybook/react'
import React from 'react'
import * as T from '../../typings'
import * as TT from '../../typings/tutorial'
import Tutorial from '../src/containers/Tutorial'
import SideBarDecorator from './utils/SideBarDecorator'

type ModifiedLevel = TT.Level & {
status: T.ProgressStatus
index: number
steps: Array<TT.Step & { status: T.ProgressStatus }>
}

const context: Partial<T.MachineContext> = {
env: { machineId: '', sessionId: '', token: '' },
error: null,
Expand Down