overleaf/services/web/frontend/stories/clone-project-modal.stories.js
Alf Eaton 67c5b2a2a1 Merge pull request #9714 from overleaf/ae-storybook
Fix errors in Storybook stories

GitOrigin-RevId: 54ff960f0a40e63eac69afa8727faaabb1289493
2022-09-23 08:05:06 +00:00

53 lines
1.2 KiB
JavaScript

import useFetchMock from './hooks/use-fetch-mock'
import CloneProjectModal from '../js/features/clone-project-modal/components/clone-project-modal'
import { ScopeDecorator } from './decorators/scope'
export const Success = args => {
useFetchMock(fetchMock => {
fetchMock.post(
'express:/project/:projectId/clone',
{ status: 200 },
{ delay: 250 }
)
})
return <CloneProjectModal {...args} />
}
export const GenericErrorResponse = args => {
useFetchMock(fetchMock => {
fetchMock.post(
'express:/project/:projectId/clone',
{ status: 500 },
{ delay: 250 }
)
})
return <CloneProjectModal {...args} />
}
export const SpecificErrorResponse = args => {
useFetchMock(fetchMock => {
fetchMock.post(
'express:/project/:projectId/clone',
{ status: 400, body: 'The project name is not valid' },
{ delay: 250 }
)
})
return <CloneProjectModal {...args} />
}
export default {
title: 'Editor / Modals / Clone Project',
component: CloneProjectModal,
args: {
show: true,
},
argTypes: {
handleHide: { action: 'close modal' },
openProject: { action: 'open project' },
handleAfterCloned: { action: 'after cloned' },
},
decorators: [ScopeDecorator],
}