import React from 'react'
import {DefaultElement} from '5e-slate-react'
import Mention from './mentions/mentions'
import Completions from './completions'

// 体现的渲染节点
const Element = (props: any) => {
  const {element, attributes, children} = props
  switch (element.type) {
    case 'paragraph':
      return (
        <div className="paragraph-wrapper" {...attributes}>
          {children}
        </div>
      )
    case 'mention':
      return <Mention {...props} />
    case 'completion':
      return <Completions {...props} />
    default:
      return <DefaultElement {...props} />
  }
}

export default Element
