node.tsx 856 B

1234567891011121314151617181920212223242526272829
  1. import type { FC } from 'react'
  2. import React from 'react'
  3. import ReadonlyInputWithSelectVar from '../_base/components/readonly-input-with-select-var'
  4. import type { HttpNodeType } from './types'
  5. import type { NodeProps } from '@/app/components/workflow/types'
  6. const Node: FC<NodeProps<HttpNodeType>> = ({
  7. id,
  8. data,
  9. }) => {
  10. const { method, url } = data
  11. if (!url)
  12. return null
  13. return (
  14. <div className='mb-1 px-3 py-1'>
  15. <div className='flex items-start p-1 rounded-md bg-gray-100'>
  16. <div className='flex items-center h-4 shrink-0 px-1 rounded bg-gray-25 text-xs font-semibold text-gray-700 uppercase'>{method}</div>
  17. <div className='pl-1 pt-1'>
  18. <ReadonlyInputWithSelectVar
  19. value={url}
  20. nodeId={id}
  21. />
  22. </div>
  23. </div>
  24. </div>
  25. )
  26. }
  27. export default React.memo(Node)