forge
Explore
Log in

Don't you dare go Hollow

🎨 improve data-table row interaction and empty state styling

Browse files at this commit

802ddc760269beb0664f26de3a9ed2b33157781aBurak BoduroğluParent: 318e273
  • style
    • 🎨 improve data-table row interaction and empty state styling
Show full message
style: 🎨 improve data-table row interaction and empty state styling
- add role='button' for clickable rows
- add keyboard focus and active states for clickable rows
- soften empty state border/bg styling
src/components/ui/data-table.tsxmodified+3 -2
@@ -220,8 +220,9 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
220 {(row) => (220 {(row) => (
221 <TableRow221 <TableRow
222 data-state={row.getIsSelected() ? "selected" : undefined}222 data-state={row.getIsSelected() ? "selected" : undefined}
223+ role={props.onRowClick ? "button" : undefined}
223 tabIndex={props.onRowClick ? 0 : undefined}224 tabIndex={props.onRowClick ? 0 : undefined}
224- class={props.onRowClick ? "cursor-pointer" : undefined}225+ class={props.onRowClick ? "cursor-pointer outline-none focus-visible:bg-primary/[0.06] focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring active:bg-primary/[0.08]" : undefined}
225 onClick={(event) => {226 onClick={(event) => {
226 if (!props.onRowClick || isInteractiveTarget(event.target)) return;227 if (!props.onRowClick || isInteractiveTarget(event.target)) return;
227 props.onRowClick(row.original);228 props.onRowClick(row.original);
@@ -269,7 +270,7 @@ export function DataTableFrame(props: ParentProps<{ class?: string }>) {
269 270
270 export function DataTableEmpty(props: ParentProps<{ class?: string }>) {271 export function DataTableEmpty(props: ParentProps<{ class?: string }>) {
271 return (272 return (
272- <div class={cn("rounded-lg border border-dashed border-border/80 bg-muted/20 px-4 py-10 text-center text-sm leading-6 text-muted-foreground", props.class)}>273+ <div class={cn("rounded-2xl border border-dashed border-border/70 bg-muted/15 px-6 py-10 text-center text-sm leading-6 text-muted-foreground", props.class)}>
273 {props.children}274 {props.children}
274 </div>275 </div>
275 );276 );