File tree Expand file tree Collapse file tree
packages/app/src/components Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,24 +6,29 @@ import {
66 IconDotsVertical ,
77 IconEye ,
88 IconEyeOff ,
9+ IconGripVertical ,
910 IconPlus ,
1011 IconTrash ,
1112} from '@tabler/icons-react' ;
1213
14+ import { type DragHandleProps } from '@/components/DashboardDndContext' ;
15+
1316export default function SectionHeader ( {
1417 section,
1518 tileCount,
1619 onToggle,
1720 onRename,
1821 onDelete,
1922 onAddTile,
23+ dragHandleProps,
2024} : {
2125 section : DashboardContainer ;
2226 tileCount : number ;
2327 onToggle : ( ) => void ;
2428 onRename ?: ( newTitle : string ) => void ;
2529 onDelete ?: ( ) => void ;
2630 onAddTile ?: ( ) => void ;
31+ dragHandleProps ?: DragHandleProps ;
2732} ) {
2833 const [ editing , setEditing ] = useState ( false ) ;
2934 const [ editedTitle , setEditedTitle ] = useState ( section . title ) ;
@@ -59,11 +64,32 @@ export default function SectionHeader({
5964 onMouseEnter = { ( ) => setHovered ( true ) }
6065 onMouseLeave = { ( ) => setHovered ( false ) }
6166 style = { {
62- borderBottom : '1px solid var(--mantine-color-dark-4 )' ,
67+ borderBottom : '1px solid var(--mantine-color-default-border )' ,
6368 userSelect : 'none' ,
6469 } }
6570 data-testid = { `section-header-${ section . id } ` }
6671 >
72+ { dragHandleProps && (
73+ < div
74+ { ...dragHandleProps }
75+ style = { {
76+ cursor : 'grab' ,
77+ display : 'flex' ,
78+ alignItems : 'center' ,
79+ padding : 2 ,
80+ flexShrink : 0 ,
81+ opacity : showControls ? 1 : 0 ,
82+ transition : 'opacity 150ms' ,
83+ } }
84+ title = "Drag to reorder sections"
85+ data-testid = { `section-drag-handle-${ section . id } ` }
86+ >
87+ < IconGripVertical
88+ size = { 14 }
89+ style = { { color : 'var(--mantine-color-dimmed)' } }
90+ />
91+ </ div >
92+ ) }
6793 < Flex
6894 align = "center"
6995 gap = "xs"
You can’t perform that action at this time.
0 commit comments