import React from "react";

export const cellTags = ["th", "td"] as const;

export type CellTag = (typeof cellTags)[number];

export interface CellProps extends React.HTMLAttributes<HTMLTableCellElement> {
  /** Render cell as */
  tag?: CellTag;
  /** Scope attribute for th elements */
  scope?: string;
}

const Cell: React.FC<CellProps> = ({ tag = "td", ...other }) => {
  const Tag = tag;

  return <Tag {...other} />;
};

Cell.displayName = "TableCell";

export { Cell };
