NodeRender.tsx 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. 'use client';
  2. import React, { useMemo } from 'react'
  3. import { BsArrowLeft, BsArrowRight } from "react-icons/bs";
  4. import Form from './NodeType/Form';
  5. import * as R from 'ramda'
  6. const NodeRender = ({ node }) => {
  7. const Comp = useMemo(() => {
  8. return R.cond([
  9. [R.propEq('form_card', 'type'), R.always(Form)],
  10. [R.T, R.always('div')],
  11. ])(node)
  12. }, [node?.id])
  13. return (
  14. // <div className="flex-1 shadow-xl rounded-box p-2">node render</div>
  15. <div className="card card-compact shadow-xl flex-1">
  16. <div className="card-body">
  17. <div className="card-title rounded-box bg-slate-200 p-2">
  18. <h2 className="flex-1">
  19. Card title!
  20. </h2>
  21. <button className='btn btn-circle btn-sm'><BsArrowLeft /></button>
  22. <button className='btn btn-circle btn-sm'><BsArrowRight /></button>
  23. </div>
  24. <Comp node={node}></Comp>
  25. {/* TODO */}
  26. {/* <div className="card-actions justify-end">
  27. <button className="btn btn-primary">确认,下一步</button>
  28. </div> */}
  29. </div>
  30. </div>
  31. )
  32. }
  33. export default React.memo(React.forwardRef(NodeRender))