2
0

preview.tsx 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /**
  2. * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates
  3. * SPDX-License-Identifier: MIT
  4. */
  5. /* eslint-disable import/no-unresolved */
  6. import nodeRegistriesCode from '@flowgram.ai/demo-fixed-layout-simple/src/node-registries.ts?raw';
  7. import initialDataCode from '@flowgram.ai/demo-fixed-layout-simple/src/initial-data.ts?raw';
  8. import indexCssCode from '@flowgram.ai/demo-fixed-layout-simple/src/index.css?raw';
  9. import useEditorPropsCode from '@flowgram.ai/demo-fixed-layout-simple/src/hooks/use-editor-props.tsx?raw';
  10. import editorCode from '@flowgram.ai/demo-fixed-layout-simple/src/editor.tsx?raw';
  11. import toolsCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/tools.tsx?raw';
  12. import nodeAdderCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/node-adder.tsx?raw';
  13. import miniMapCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/minimap.tsx?raw';
  14. import branchAdderCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/branch-adder.tsx?raw';
  15. import baseNodeCode from '@flowgram.ai/demo-fixed-layout-simple/src/components/base-node.tsx?raw';
  16. import { FixedLayoutSimple } from './index';
  17. import { PreviewEditor } from '../preview-editor';
  18. const indexCode = {
  19. code: editorCode,
  20. active: true,
  21. };
  22. export const FixedLayoutSimplePreview = () => (
  23. <div
  24. style={{
  25. zIndex: 1,
  26. position: 'relative',
  27. }}
  28. >
  29. <PreviewEditor
  30. files={{
  31. 'editor.tsx': indexCode,
  32. 'index.css': indexCssCode,
  33. 'initial-data.ts': initialDataCode,
  34. 'node-registries.ts': nodeRegistriesCode,
  35. 'use-editor-props.tsx': useEditorPropsCode,
  36. 'base-node.tsx': baseNodeCode,
  37. 'branch-adder.tsx': branchAdderCode,
  38. 'minimap.tsx': miniMapCode,
  39. 'node-adder.tsx': nodeAdderCode,
  40. 'tools.tsx': toolsCode,
  41. }}
  42. previewStyle={{
  43. height: 500,
  44. }}
  45. editorStyle={{
  46. height: 500,
  47. }}
  48. >
  49. <FixedLayoutSimple />
  50. </PreviewEditor>
  51. </div>
  52. );