import type { ButtonHTMLAttributes, ReactNode } from 'react' import { ChevronDown, ChevronUp } from 'lucide-react' import { cn } from '@/lib/cn' export type Column = { key: string header: ReactNode render: (row: T) => ReactNode sortable?: boolean width?: string align?: 'left' | 'center' | 'right' } // Always-visible row-action button (NAMGROUP convention: NEVER hide actions // behind opacity-0 group-hover — touch devices can't reveal them). 7×7 icon // button, tone-tinted hover. Wrap an action cell with to stop the // row's onClick from firing when a button is pressed. type RowActionTone = 'default' | 'brand' | 'danger' | 'success' const ROW_ACTION_TONE: Record = { default: 'text-slate-500 hover:bg-slate-100 hover:text-slate-800', brand: 'text-slate-500 hover:bg-brand-50 hover:text-brand-700', danger: 'text-slate-500 hover:bg-red-50 hover:text-red-600', success: 'text-slate-500 hover:bg-emerald-50 hover:text-emerald-600', } export function RowActions({ children, className }: { children: ReactNode; className?: string }) { return (
e.stopPropagation()} > {children}
) } export function RowActionButton({ tone = 'default', className, ...props }: ButtonHTMLAttributes & { tone?: RowActionTone }) { return ( Trang {page}/{totalPages} ) }