mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 21:08:12 +00:00
chore: fmt
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { ReactNode } from "react";
|
||||
|
||||
export interface TableColumn<T> {
|
||||
key: string;
|
||||
@@ -14,7 +14,12 @@ export interface TableProps<T> {
|
||||
emptyMessage?: string;
|
||||
}
|
||||
|
||||
function Table<T>({ columns, data, rowKey, emptyMessage = 'No data' }: TableProps<T>) {
|
||||
function Table<T>({
|
||||
columns,
|
||||
data,
|
||||
rowKey,
|
||||
emptyMessage = "No data",
|
||||
}: TableProps<T>) {
|
||||
return (
|
||||
<div className="overflow-x-auto rounded-md border border-gray-200">
|
||||
<table className="min-w-full divide-y divide-gray-200 text-sm">
|
||||
@@ -34,7 +39,10 @@ function Table<T>({ columns, data, rowKey, emptyMessage = 'No data' }: TableProp
|
||||
<tbody className="divide-y divide-gray-100 bg-white">
|
||||
{data.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={columns.length} className="px-4 py-6 text-center text-gray-500">
|
||||
<td
|
||||
colSpan={columns.length}
|
||||
className="px-4 py-6 text-center text-gray-500"
|
||||
>
|
||||
{emptyMessage}
|
||||
</td>
|
||||
</tr>
|
||||
@@ -45,7 +53,9 @@ function Table<T>({ columns, data, rowKey, emptyMessage = 'No data' }: TableProp
|
||||
<td key={column.key} className="px-4 py-2 text-gray-900">
|
||||
{column.render
|
||||
? column.render(row)
|
||||
: ((row as unknown as Record<string, ReactNode>)[column.key] ?? '-')}
|
||||
: ((row as unknown as Record<string, ReactNode>)[
|
||||
column.key
|
||||
] ?? "-")}
|
||||
</td>
|
||||
))}
|
||||
</tr>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { default } from './Table';
|
||||
export type { TableProps, TableColumn } from './Table';
|
||||
export { default } from "./Table";
|
||||
export type { TableProps, TableColumn } from "./Table";
|
||||
|
||||
Reference in New Issue
Block a user