mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
f8cb1638d1
Add useFetchMock hook for use in Storybook GitOrigin-RevId: 4eb1c5edf2f94dc6ad51358e109e29c9f62d2058
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
import React from 'react'
|
|
import { ContextRoot } from '../js/shared/context/root-context'
|
|
import { setupContext } from './fixtures/context'
|
|
import importOverleafModules from '../macros/import-overleaf-module.macro'
|
|
import useFetchMock from './hooks/use-fetch-mock'
|
|
|
|
const [
|
|
{
|
|
import: { default: GitBridgeModal },
|
|
},
|
|
] = importOverleafModules('gitBridge')
|
|
|
|
setupContext()
|
|
|
|
export const GitBridgeUrlModal = args => <GitBridgeModal {...args} />
|
|
GitBridgeUrlModal.args = {
|
|
type: 'show_url',
|
|
}
|
|
|
|
export const CollaboratorModal = args => <GitBridgeModal {...args} />
|
|
CollaboratorModal.args = {
|
|
type: 'collaborator',
|
|
}
|
|
|
|
export const TeaserModal = args => {
|
|
useFetchMock(fetchMock => fetchMock.post('express:/event/:key', 202))
|
|
|
|
return <GitBridgeModal {...args} />
|
|
}
|
|
TeaserModal.args = {
|
|
type: 'teaser',
|
|
}
|
|
|
|
export default {
|
|
title: 'Modals / Git Bridge',
|
|
component: GitBridgeModal,
|
|
args: {
|
|
show: true,
|
|
},
|
|
argTypes: {
|
|
handleHide: { action: 'handleHide' },
|
|
},
|
|
decorators: [
|
|
Story => (
|
|
<>
|
|
<ContextRoot ide={window._ide} settings={{}}>
|
|
<Story />
|
|
</ContextRoot>
|
|
</>
|
|
),
|
|
],
|
|
}
|