import * as React from 'react';

import s from './TableHead.module.scss';

interface ITableHeadProps {
  children: React.ReactNode;
}

const TableHead = ({ children, ...theadProps }: ITableHeadProps) => {
  return (
    <thead className={s.tableHead} {...theadProps}>
      <tr>
        {React.Children.toArray(children).map((c) =>
          React.cloneElement(c as React.ReactElement<any>, { header: true }),
        )}
      </tr>
    </thead>
  );
};

export default TableHead;
