git-bridge-modal.stories.js 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. import { ContextRoot } from '../js/shared/context/root-context'
  2. import { setupContext } from './fixtures/context'
  3. import importOverleafModules from '../macros/import-overleaf-module.macro'
  4. import useFetchMock from './hooks/use-fetch-mock'
  5. const [
  6. {
  7. import: { default: GitBridgeModal },
  8. },
  9. ] = importOverleafModules('gitBridge')
  10. setupContext()
  11. export const GitBridgeUrlModal = args => <GitBridgeModal {...args} />
  12. GitBridgeUrlModal.args = {
  13. type: 'show_url',
  14. }
  15. export const CollaboratorModal = args => <GitBridgeModal {...args} />
  16. CollaboratorModal.args = {
  17. type: 'collaborator',
  18. }
  19. export const TeaserModal = args => {
  20. useFetchMock(fetchMock => fetchMock.post('express:/event/:key', 202))
  21. return <GitBridgeModal {...args} />
  22. }
  23. TeaserModal.args = {
  24. type: 'teaser',
  25. }
  26. export default {
  27. title: 'Modals / Git Bridge',
  28. component: GitBridgeModal,
  29. args: {
  30. show: true,
  31. },
  32. argTypes: {
  33. handleHide: { action: 'handleHide' },
  34. },
  35. decorators: [
  36. Story => (
  37. <>
  38. <ContextRoot ide={window._ide} settings={{}}>
  39. <Story />
  40. </ContextRoot>
  41. </>
  42. ),
  43. ],
  44. }