composite-nodes-preview.tsx 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  1. /* eslint-disable import/no-unresolved */
  2. import { FixedLayoutSimple } from './fixed-layout-simple.tsx';
  3. import { PreviewEditor } from '../preview-editor.tsx';
  4. import tryCatch from '!!raw-loader!@flowgram.ai/demo-fixed-layout-simple/src/data/tryCatch.ts';
  5. import multiOutputs from '!!raw-loader!@flowgram.ai/demo-fixed-layout-simple/src/data/multiOutputs.ts';
  6. import multiInputs from '!!raw-loader!@flowgram.ai/demo-fixed-layout-simple/src/data/multiInputs.ts';
  7. import loop from '!!raw-loader!@flowgram.ai/demo-fixed-layout-simple/src/data/loop.ts';
  8. import dynamicSplit from '!!raw-loader!@flowgram.ai/demo-fixed-layout-simple/src/data/dynamicSplit.ts';
  9. export function CompositeNodesPreview(props: { cellHeight?: number }) {
  10. const previewWidth = '50%';
  11. const editorWidth = '50%';
  12. const cellHeight = props.cellHeight || 300;
  13. return (
  14. <table className="" style={{ width: '100%', border: '1px solid var(--rp-c-divider-light)' }}>
  15. <tr>
  16. <td style={{ textAlign: 'center' }}>dynamicSplit</td>
  17. <td>
  18. <PreviewEditor
  19. codeInRight
  20. files={{
  21. 'index.tsx': {
  22. code: dynamicSplit,
  23. active: true,
  24. },
  25. }}
  26. previewStyle={{
  27. width: previewWidth,
  28. height: cellHeight,
  29. position: 'relative',
  30. }}
  31. editorStyle={{
  32. width: editorWidth,
  33. height: cellHeight,
  34. }}
  35. >
  36. <FixedLayoutSimple hideTools demo="dynamicSplit" />
  37. </PreviewEditor>
  38. </td>
  39. </tr>
  40. <tr>
  41. <td style={{ textAlign: 'center' }}>loop</td>
  42. <td>
  43. <PreviewEditor
  44. codeInRight
  45. files={{
  46. 'index.tsx': {
  47. code: loop,
  48. active: true,
  49. },
  50. }}
  51. previewStyle={{
  52. width: previewWidth,
  53. height: cellHeight,
  54. position: 'relative',
  55. }}
  56. editorStyle={{
  57. height: cellHeight,
  58. width: editorWidth,
  59. }}
  60. >
  61. <FixedLayoutSimple hideTools demo="loop" />
  62. </PreviewEditor>
  63. </td>
  64. </tr>
  65. <tr>
  66. <td style={{ textAlign: 'center' }}>tryCatch</td>
  67. <td>
  68. <PreviewEditor
  69. codeInRight
  70. files={{
  71. 'index.tsx': {
  72. code: tryCatch,
  73. active: true,
  74. },
  75. }}
  76. previewStyle={{
  77. width: previewWidth,
  78. height: cellHeight,
  79. position: 'relative',
  80. }}
  81. editorStyle={{
  82. height: cellHeight,
  83. width: editorWidth,
  84. }}
  85. >
  86. <FixedLayoutSimple hideTools demo="tryCatch" />
  87. </PreviewEditor>
  88. </td>
  89. </tr>
  90. <tr>
  91. <td style={{ textAlign: 'center' }}>multiInputs</td>
  92. <td>
  93. <PreviewEditor
  94. codeInRight
  95. files={{
  96. 'index.tsx': {
  97. code: multiInputs,
  98. active: true,
  99. },
  100. }}
  101. previewStyle={{
  102. width: previewWidth,
  103. height: cellHeight,
  104. position: 'relative',
  105. }}
  106. editorStyle={{
  107. height: cellHeight,
  108. width: editorWidth,
  109. }}
  110. >
  111. <FixedLayoutSimple hideTools demo="multiInputs" />
  112. </PreviewEditor>
  113. </td>
  114. </tr>
  115. <tr>
  116. <td style={{ textAlign: 'center' }}>multiOutputs</td>
  117. <td>
  118. <PreviewEditor
  119. codeInRight
  120. files={{
  121. 'index.tsx': {
  122. code: multiOutputs,
  123. active: true,
  124. },
  125. }}
  126. previewStyle={{
  127. width: previewWidth,
  128. height: cellHeight,
  129. position: 'relative',
  130. }}
  131. editorStyle={{
  132. height: cellHeight,
  133. width: editorWidth,
  134. }}
  135. >
  136. <FixedLayoutSimple hideTools demo="multiOutputs" />
  137. </PreviewEditor>
  138. </td>
  139. </tr>
  140. </table>
  141. );
  142. }