@@ -8,12 +8,13 @@ import { Table } from "@/components/table"
88interface DataTableSortableHeaderCellProps extends React . HTMLAttributes < HTMLTableCellElement > {
99 id : string
1010 children : React . ReactNode
11+ isFirstColumn ?: boolean
1112}
1213
1314export const DataTableSortableHeaderCell = React . forwardRef <
1415 HTMLTableCellElement ,
1516 DataTableSortableHeaderCellProps
16- > ( ( { id, children, className, style : propStyle , ...props } , ref ) => {
17+ > ( ( { id, children, className, style : propStyle , isFirstColumn , ...props } , ref ) => {
1718 const {
1819 attributes,
1920 listeners,
@@ -58,32 +59,32 @@ export const DataTableSortableHeaderCell = React.forwardRef<
5859 < Table . HeaderCell
5960 ref = { combineRefs }
6061 style = { style }
61- className = { clx ( className , {
62+ className = { clx ( className , "group/header-cell relative" , {
6263 "cursor-grabbing" : isDragging ,
6364 } ) }
6465 { ...props }
6566 >
66- < div className = "group/header-cell flex h-full w-full items-center gap-1" >
67- < button
68- type = "button"
69- className = { clx (
70- "flex h-5 w-4 cursor-grab items-center justify-center rounded outline-none ",
71- "text-ui-text-subtle transition-all ",
72- "opacity-0 group-hover/header-cell:opacity-100 ",
73- "hover:text-ui-text-base ",
74- "focus-visible :text-ui-text-base focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ui-focus ",
75- "disabled:cursor-not-allowed disabled :text-ui-text-disabled ",
76- {
77- "opacity-100" : isDragging ,
78- }
79- ) }
80- { ... attributes }
81- { ...listeners }
82- >
83- < DotsSix className = "h-4 w-4" / >
84- </ button >
85- < div className = "flex-1" > { children } </ div >
86- </ div >
67+ < button
68+ type = " button"
69+ className = { clx (
70+ "absolute top-1/2 -translate-y-1/2 z-10" ,
71+ isFirstColumn ? "left-[6px]" : "-left-[18px] ",
72+ "flex h-5 w-4 cursor-grab items-center justify-center rounded outline-none ",
73+ "text-ui-text-subtle transition-all ",
74+ "opacity-0 group-hover/header-cell:opacity-100 ",
75+ "hover :text-ui-text-base",
76+ "focus-visible :text-ui-text-base focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-ui-focus ",
77+ "disabled:cursor-not-allowed disabled:text-ui-text-disabled" ,
78+ {
79+ "opacity-100" : isDragging ,
80+ }
81+ ) }
82+ { ...attributes }
83+ { ... listeners }
84+ >
85+ < DotsSix className = "h-4 w-4" / >
86+ </ button >
87+ { children }
8788 </ Table . HeaderCell >
8889 )
8990} )
0 commit comments