import React from 'react'

// 行内元素特殊标记: 粗体/代码块/斜体/下划线
const Leaf = (props: any) => {
  let children = props.children
  const {leaf, attributes} = props
  if (leaf.bold) {
    children = <strong>{children}</strong>
  }
  if (leaf.code) {
    children = <code>{children}</code>
  }
  if (leaf.italic) {
    children = <em>{children}</em>
  }
  if (leaf.underline) {
    children = <u>{children}</u>
  }
  return <span {...attributes}>{children}</span>
}

export default Leaf
