🎨 add group/row hover reveal for row actions, clean up row class
Browse files at this commit7dcc8e3ec035d65d4b29b480e4c45ef46fa4833cParent: 802ddc7- style
- 🎨 add group/row hover reveal for row actions, clean up row class
2 changed files +5 -2
src/components/ui/data-table.tsxmodified+4 -1
| @@ -222,7 +222,10 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData, | ||
| 222 | 222 | data-state={row.getIsSelected() ? "selected" : undefined} |
| 223 | 223 | role={props.onRowClick ? "button" : undefined} |
| 224 | 224 | tabIndex={props.onRowClick ? 0 : 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 | + class={cn( | |
| 226 | + "group/row", | |
| 227 | + 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]", | |
| 228 | + )} | |
| 226 | 229 | onClick={(event) => { |
| 227 | 230 | if (!props.onRowClick || isInteractiveTarget(event.target)) return; |
| 228 | 231 | props.onRowClick(row.original); |
src/components/ui/table-row-actions.tsxmodified+1 -1
| @@ -21,7 +21,7 @@ export function TableRowActions(props: { label: string; actions: TableRowAction[ | ||
| 21 | 21 | <div class="flex justify-center"> |
| 22 | 22 | <DropdownMenu placement="bottom-end" gutter={6}> |
| 23 | 23 | <DropdownMenuTrigger |
| 24 | - class="inline-flex h-11 w-11 items-center justify-center rounded-xl text-muted-foreground outline-none transition-all duration-150 hover:bg-secondary hover:text-foreground active:scale-[0.96] focus-visible:ring-2 focus-visible:ring-ring data-[expanded]:bg-secondary data-[expanded]:text-foreground" | |
| 24 | + class="inline-flex h-11 w-11 items-center justify-center rounded-xl text-muted-foreground opacity-75 outline-none transition-all duration-150 hover:bg-secondary hover:text-foreground hover:opacity-100 active:scale-[0.96] focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ring data-[expanded]:bg-secondary data-[expanded]:text-foreground data-[expanded]:opacity-100 sm:opacity-45 sm:group-hover/row:opacity-100" | |
| 25 | 25 | aria-label={props.label} |
| 26 | 26 | > |
| 27 | 27 | <IconDotsVertical class="h-4 w-4" /> |