Skip to content

Commit

Permalink
feat: add delete workspace modal storybook
Browse files Browse the repository at this point in the history
  • Loading branch information
hanstirtaputra committed Jun 27, 2022
1 parent 1b43b53 commit 39d124c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { MemoryRouter } from 'react-router-dom'
import { useDisclosure } from '@chakra-ui/react'
import { Meta, Story } from '@storybook/react'

import { userHandlers } from '~/mocks/msw/handlers/user'

import {
fullScreenDecorator,
getMobileViewParameters,
LoggedInDecorator,
} from '~utils/storybook'
import { getMobileViewParameters } from '~utils/storybook'

import {
CreateOrRenameWorkspaceModal,
Expand All @@ -18,11 +13,6 @@ import {
export default {
title: 'Pages/WorkspacePage/CreateOrRenameWorkspaceModal',
component: CreateOrRenameWorkspaceModal,
decorators: [
(storyFn) => <MemoryRouter>{storyFn()}</MemoryRouter>,
fullScreenDecorator,
LoggedInDecorator,
],
parameters: {
layout: 'fullscreen',
// Prevent flaky tests due to modal animating in.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import { useDisclosure } from '@chakra-ui/react'
import { Meta, Story } from '@storybook/react'

import { userHandlers } from '~/mocks/msw/handlers/user'

import { getMobileViewParameters } from '~utils/storybook'

import {
DeleteWorkspaceModal,
DeleteWorkspaceModalProps,
} from '../WorkspaceModals/DeleteWorkspaceModal'

export default {
title: 'Pages/WorkspacePage/DeleteWorkspaceModal',
component: DeleteWorkspaceModal,
parameters: {
layout: 'fullscreen',
// Prevent flaky tests due to modal animating in.
chromatic: { pauseAnimationAtEnd: true },
msw: userHandlers({ delay: 0 }),
},
} as Meta

const Template: Story<DeleteWorkspaceModalProps> = (args) => {
const modalProps = useDisclosure({ defaultIsOpen: true })

return (
<DeleteWorkspaceModal
{...args}
{...modalProps}
onClose={() => console.log('close modal')}
/>
)
}
export const DeleteWorkspace = Template.bind({})

export const DeleteWorkspaceMobile = Template.bind({})
DeleteWorkspaceMobile.parameters = getMobileViewParameters()

0 comments on commit 39d124c

Please sign in to comment.