import { ContentTreeWorkarounds } from '@financial-times/cp-content-pipeline-schema'
import React from 'react'
import { ContentProps } from '../../types'

interface TableBodyProps
  extends ContentProps<ContentTreeWorkarounds.TableBody> {}

const TableBody: React.FC<React.PropsWithChildren<TableBodyProps>> = ({
  children,
}) => {
  const [headerRow, ...bodyRows] = React.Children.toArray(children)

  return (
    <>
      <thead>{headerRow}</thead>
      <tbody>{bodyRows}</tbody>
    </>
  )
}

export default TableBody
