pdf-compile-button.stories.tsx 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. import { FC } from 'react'
  2. import type { Meta } from '@storybook/react'
  3. import PdfCompileButton from '@/features/pdf-preview/components/pdf-compile-button'
  4. import { ScopeDecorator } from '../decorators/scope'
  5. import { CompileContext } from '@/shared/context/local-compile-context'
  6. import { DetachCompileContext } from '@/shared/context/detach-compile-context'
  7. export const CompileButton: FC<CompileContext> = (props: CompileContext) => (
  8. <DetachCompileContext.Provider value={props}>
  9. <div className="pdf m-5">
  10. <div className="toolbar toolbar-pdf toolbar-pdf-hybrid btn-toolbar">
  11. <div className="toolbar-pdf-left">
  12. <PdfCompileButton />
  13. </div>
  14. </div>
  15. </div>
  16. </DetachCompileContext.Provider>
  17. )
  18. const args: Partial<CompileContext> = {
  19. autoCompile: false,
  20. compiling: false,
  21. draft: false,
  22. hasChanges: false,
  23. stopOnFirstError: false,
  24. stopOnValidationError: false,
  25. animateCompileDropdownArrow: false,
  26. }
  27. const meta: Meta<typeof CompileButton> = {
  28. title: 'Editor / Toolbar / Compile Button',
  29. component: CompileButton,
  30. // @ts-ignore
  31. decorators: [ScopeDecorator],
  32. argTypes: {
  33. startCompile: { action: 'startCompile' },
  34. setAutoCompile: { action: 'setAutoCompile' },
  35. setCompiling: { action: 'setCompiling' },
  36. setDraft: { action: 'setDraft' },
  37. setStopOnFirstError: { action: 'setStopOnFirstError' },
  38. setError: { action: 'setError' },
  39. setHasLintingError: { action: 'setHasLintingError' },
  40. setPosition: { action: 'setPosition' },
  41. setStopOnValidationError: { action: 'setStopOnValidationError' },
  42. recompileFromScratch: { action: 'recompileFromScratch' },
  43. stopCompile: { action: 'stopCompile' },
  44. setAnimateCompileDropdownArrow: {
  45. action: 'setAnimateCompileDropdownArrow',
  46. },
  47. },
  48. args,
  49. }
  50. export default meta