mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-04 18:54:23 -05:00
4a8b79080b
* [storybook] Update Storybook to version 8.3.5 * [storybook] Run storybook with `--no-open`. Fixes xdg-utils issue * [storybook] Create decorator for BS3/BS5 * [storybook] Add `bsVersionDecorator` to stories * [storybook] Fix bugs in stories * [storybook] Fixup `useMeta` type. Use `DeepPartial` * [storybook] Fix types GitOrigin-RevId: 48c0f0fefb1ab2d4863ab59051b900b1908a613c
73 lines
1.7 KiB
JavaScript
73 lines
1.7 KiB
JavaScript
import useFetchMock from '../hooks/use-fetch-mock'
|
|
import LeaveModal from '../../js/features/settings/components/leave/modal'
|
|
import LeaveSection from '../../js/features/settings/components/leave-section'
|
|
import { setDefaultMeta, defaultSetupMocks } from './helpers/leave'
|
|
import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
|
|
|
|
export const Section = args => {
|
|
useFetchMock(defaultSetupMocks)
|
|
setDefaultMeta()
|
|
|
|
return <LeaveSection {...args} />
|
|
}
|
|
Section.component = LeaveSection
|
|
Section.parameters = { controls: { include: [], hideNoControlsWarning: true } }
|
|
|
|
export const ModalSuccess = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalWithoutPassword = args => {
|
|
setDefaultMeta()
|
|
window.metaAttributesCache.set('ol-hasPassword', false)
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalAuthError = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(/\/user\/delete/, 403)
|
|
})
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalServerError = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(/\/user\/delete/, 500)
|
|
})
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export const ModalSubscriptionError = args => {
|
|
setDefaultMeta()
|
|
useFetchMock(fetchMock => {
|
|
fetchMock.post(/\/user\/delete/, {
|
|
status: 422,
|
|
body: {
|
|
error: 'SubscriptionAdminDeletionError',
|
|
},
|
|
})
|
|
})
|
|
|
|
return <LeaveModal {...args} />
|
|
}
|
|
|
|
export default {
|
|
title: 'Account Settings / Leave',
|
|
component: LeaveModal,
|
|
args: {
|
|
isOpen: true,
|
|
},
|
|
argTypes: {
|
|
handleClose: { action: 'handleClose' },
|
|
...bsVersionDecorator.argTypes,
|
|
},
|
|
}
|