Brijesh's Git Server — watchman @ 242871c6f0dd3c1670d49334a7f551c68b7a518e

observability tool, needs to be rewritten once identity is stable

client/src/components/table.tsx (view raw)

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
export default function Table({
  columns,
  data,
}: {
  columns: string[];
  data: any[];
}) {
  return (
    <div>
      <div className="flow-root">
        <div className="-mx-4 -my-2 overflow-x-auto sm:-mx-6 lg:-mx-8">
          <div className="inline-block min-w-full py-2 align-middle sm:px-6 lg:px-8">
            <div className="overflow-hidden shadow ring-1 ring-slate-200 sm:-lg">
              <table className="min-w-full divide-y divide-slate-200">
                <thead className="bg-slate-100">
                  <tr>
                    {columns.map((column: string) => (
                      <th
                        key={column}
                        scope="col"
                        className="px-3 py-2 text-left text-sm font-semibold text-slate-500"
                      >
                        {column}
                      </th>
                    ))}
                  </tr>
                </thead>
                <tbody className="divide-y divide-slate-200 bg-white">
                  {data.map((row: any) => (
                    <tr key={row.id}>
                      {columns.map((column: string) => (
                        <td
                          key={column}
                          className="whitespace-nowrap py-2 px-3 text-sm text-slate-600"
                        >
                          {row[column.toLowerCase()]}
                        </td>
                      ))}
                    </tr>
                  ))}
                </tbody>
              </table>
            </div>
          </div>
        </div>
      </div>
    </div>
  );
}