import React from "react";
import { TableColumn } from "./TableProps";

export interface TableColGroupProps {
  columns: TableColumn[];
}

export function TableColGroup({ columns }: TableColGroupProps) {
  return (
    <colgroup>
      {columns.map(({ key, width }) => (
        <col
          key={key}
          style={{
            width: typeof width === "undefined" ? "auto" : width,
          }}
        />
      ))}
    </colgroup>
  );
}

TableColGroup.displayName = "TableColGroup";
