fix(m4): TableRow spreads rest props for data-testid; improve E2E timeouts
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import { cn } from "@/lib/utils";
|
||||
import { HTMLAttributes, TdHTMLAttributes, ThHTMLAttributes } from "react";
|
||||
|
||||
interface TableProps {
|
||||
children: React.ReactNode;
|
||||
@@ -23,23 +24,26 @@ export function TableBody({ children }: TableProps) {
|
||||
return <tbody className="divide-y divide-gray-100">{children}</tbody>;
|
||||
}
|
||||
|
||||
export function TableRow({ children, className, onClick }: TableProps & { onClick?: () => void }) {
|
||||
export function TableRow({
|
||||
children, className, onClick, ...rest
|
||||
}: TableProps & { onClick?: () => void } & HTMLAttributes<HTMLTableRowElement>) {
|
||||
return (
|
||||
<tr
|
||||
className={cn("transition-colors", onClick && "cursor-pointer hover:bg-blue-50", className)}
|
||||
onClick={onClick}
|
||||
{...rest}
|
||||
>
|
||||
{children}
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
||||
export function Th({ children, className }: TableProps) {
|
||||
return <th className={cn("px-4 py-3 text-left font-medium", className)}>{children}</th>;
|
||||
export function Th({ children, className, ...rest }: TableProps & ThHTMLAttributes<HTMLTableCellElement>) {
|
||||
return <th className={cn("px-4 py-3 text-left font-medium", className)} {...rest}>{children}</th>;
|
||||
}
|
||||
|
||||
export function Td({ children, className }: TableProps) {
|
||||
return <td className={cn("px-4 py-3 text-gray-700", className)}>{children}</td>;
|
||||
export function Td({ children, className, ...rest }: TableProps & TdHTMLAttributes<HTMLTableCellElement>) {
|
||||
return <td className={cn("px-4 py-3 text-gray-700", className)} {...rest}>{children}</td>;
|
||||
}
|
||||
|
||||
export function EmptyState({ message = "No data yet" }: { message?: string }) {
|
||||
|
||||
Reference in New Issue
Block a user