diff --git a/src/client/components/DataTable.tsx b/src/client/components/DataTable.tsx index bdc45d3..0aef69c 100644 --- a/src/client/components/DataTable.tsx +++ b/src/client/components/DataTable.tsx @@ -19,7 +19,7 @@ import { import { Empty } from 'antd'; import React from 'react'; import { Button } from './ui/button'; -import { LuArrowRight } from 'react-icons/lu'; +import { LuChevronRight } from 'react-icons/lu'; import { cn } from '@/utils/style'; export type { ColumnDef }; @@ -50,6 +50,8 @@ export function DataTable({ getRowCanExpand: () => canExpand, }); + const columnLen = canExpand ? columns.length + 1 : columns.length; + return (
@@ -62,10 +64,10 @@ export function DataTable({ variant="ghost" size="icon" className={cn( - 'mr-1 h-5 w-5', + 'mr-1 h-5 w-5 transition-transform', table.getIsAllRowsExpanded() && 'rotate-90' )} - Icon={LuArrowRight} + Icon={LuChevronRight} onClick={table.getToggleAllRowsExpandedHandler()} /> @@ -100,10 +102,10 @@ export function DataTable({ variant="ghost" size="icon" className={cn( - 'mr-1 h-5 w-5', + 'mr-1 h-5 w-5 transition-transform', row.getIsExpanded() && 'rotate-90' )} - Icon={LuArrowRight} + Icon={LuChevronRight} onClick={row.getToggleExpandedHandler()} /> @@ -120,25 +122,23 @@ export function DataTable({ ); - if (row.getIsExpanded() && ExpandComponent) { - return ( - <> - {renderedRow} + return ( + <> + {renderedRow} + {row.getIsExpanded() && ExpandComponent && ( - + - - ); - } else { - return renderedRow; - } + )} + + ); }) ) : ( - +