import type { DataGridProps, Column } from "react-data-grid"
import DataGrid from "react-data-grid"
import { useRsi } from "../hooks/useRsi"

export type { Column }

export type Props<TRow> = DataGridProps<TRow> & {
  rowHeight?: number
  hiddenHeader?: boolean
  className?: string
  style?: React.CSSProperties
}

export const Table = <TRow,>({ className, ...props }: Props<TRow>) => {
  const { rtl } = useRsi()
  return (
    <DataGrid 
      className={"rdg-light " + (className || "")} 
      direction={rtl ? "rtl" : "ltr"} 
      {...props} 
    />
  )
}
