forge
Explore
Log in

Don't you dare go Hollow

🎨 add group/row hover reveal for row actions, clean up row class

Browse files at this commit

7dcc8e3ec035d65d4b29b480e4c45ef46fa4833cBurak BoduroğluParent: 802ddc7
  • style
    • 🎨 add group/row hover reveal for row actions, clean up row class
Show full message
style: 🎨 add group/row hover reveal for row actions, clean up row class
- wrap row class with cn() and add group/row
- row actions fade in on row hover (desktop), always visible on mobile/touch
src/components/ui/data-table.tsxmodified+4 -1
@@ -222,7 +222,10 @@ export function DataTable<TData, TValue = unknown>(props: DataTableProps<TData,
222 data-state={row.getIsSelected() ? "selected" : undefined}222 data-state={row.getIsSelected() ? "selected" : undefined}
223 role={props.onRowClick ? "button" : undefined}223 role={props.onRowClick ? "button" : undefined}
224 tabIndex={props.onRowClick ? 0 : undefined}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 onClick={(event) => {229 onClick={(event) => {
227 if (!props.onRowClick || isInteractiveTarget(event.target)) return;230 if (!props.onRowClick || isInteractiveTarget(event.target)) return;
228 props.onRowClick(row.original);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 <div class="flex justify-center">21 <div class="flex justify-center">
22 <DropdownMenu placement="bottom-end" gutter={6}>22 <DropdownMenu placement="bottom-end" gutter={6}>
23 <DropdownMenuTrigger23 <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 aria-label={props.label}25 aria-label={props.label}
26 >26 >
27 <IconDotsVertical class="h-4 w-4" />27 <IconDotsVertical class="h-4 w-4" />