refactor: modify route guard pattern
This commit is contained in:
@@ -286,12 +286,12 @@ function DataTableContent<TData, TValue>({
|
||||
<TableRow
|
||||
key={row.id}
|
||||
data-state={row.getIsSelected() && 'selected'}
|
||||
onClick={() => onRowClick?.(row.original)}
|
||||
className={cn(onRowClick && 'cursor-pointer')}
|
||||
>
|
||||
{row.getVisibleCells().map((cell) => {
|
||||
const truncate = shouldTruncateCell(cell.column);
|
||||
const pinned = cell.column.getIsPinned();
|
||||
const isActionsCell = cell.column.id === 'actions';
|
||||
const isRowClickable = Boolean(onRowClick && !isActionsCell);
|
||||
const content = flexRender(
|
||||
cell.column.columnDef.cell,
|
||||
cell.getContext(),
|
||||
@@ -301,9 +301,16 @@ function DataTableContent<TData, TValue>({
|
||||
<TableCell
|
||||
key={cell.id}
|
||||
style={getPinnedColumnStyles(cell.column)}
|
||||
onClick={
|
||||
isRowClickable
|
||||
? () => onRowClick?.(row.original)
|
||||
: undefined
|
||||
}
|
||||
className={cn(
|
||||
'max-w-0 overflow-hidden border-b border-border',
|
||||
pinned && 'bg-card',
|
||||
isRowClickable && 'cursor-pointer',
|
||||
isActionsCell && 'cursor-default',
|
||||
)}
|
||||
>
|
||||
{truncate ? (
|
||||
|
||||
Reference in New Issue
Block a user