index.tsx 688 B

12345678910111213141516171819202122232425
  1. import React, { useContext } from 'react';
  2. import { FlowNodeRegistry } from '@flowgram.ai/fixed-layout-editor';
  3. import { NodeRenderContext } from '../../context';
  4. import { FormTitleDescription, FormWrapper } from './styles';
  5. /**
  6. * @param props
  7. * @constructor
  8. */
  9. export function FormContent(props: { children?: React.ReactNode }) {
  10. const { expanded, node } = useContext(NodeRenderContext);
  11. const registry = node.getNodeRegistry<FlowNodeRegistry>();
  12. return (
  13. <FormWrapper>
  14. {expanded ? (
  15. <>
  16. <FormTitleDescription>{registry.info?.description}</FormTitleDescription>
  17. {props.children}
  18. </>
  19. ) : undefined}
  20. </FormWrapper>
  21. );
  22. }