chore: fmt

This commit is contained in:
Michael Abebe
2026-05-12 16:50:18 +03:00
parent 4540d35215
commit 1c5ee19388
181 changed files with 1492 additions and 1100 deletions

View File

@@ -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>

View File

@@ -1,2 +1,2 @@
export { default } from './Table';
export type { TableProps, TableColumn } from './Table';
export { default } from "./Table";
export type { TableProps, TableColumn } from "./Table";