@@ -21,11 +21,11 @@ import {
2121} from '@dnd-kit/sortable'
2222import { CSS } from '@dnd-kit/utilities'
2323import { css } from '@emotion/react'
24- import { Flex , IconButton } from '@radix-ui/themes'
25- import { GripVerticalIcon } from 'lucide-react'
24+ import { Flex } from '@radix-ui/themes'
2625import { useState } from 'react'
2726
2827import { EditableAction } from './EditableAction'
28+ import { EditableActionDragHandle } from './EditableActionDragHandle'
2929import { BrowserActionInstance } from './types'
3030
3131enum Position {
@@ -60,13 +60,12 @@ export function SortableBrowserActionList({
6060 if ( over && activeItem . id !== over . id ) {
6161 onSwapActions ( activeItem . id as string , over . id as string )
6262 }
63+
6364 setActive ( null )
6465 }
6566
6667 function handleDragStart ( event : DragStartEvent ) {
67- setActive (
68- actions . find ( ( action ) => action . id === event . active . id ) ?? null
69- )
68+ setActive ( actions . find ( ( action ) => action . id === event . active . id ) ?? null )
7069 }
7170
7271 return (
@@ -86,29 +85,17 @@ export function SortableBrowserActionList({
8685 < SortableEditableAction
8786 key = { action . id }
8887 action = { action }
89- onRemove = { onRemoveAction }
9088 onChange = { onChangeAction }
89+ onRemove = { onRemoveAction }
9190 />
9291 ) ) }
9392 < DragOverlay modifiers = { [ restrictToFirstScrollableAncestor ] } >
9493 { active ? (
9594 < EditableAction
9695 action = { active }
97- onRemove = { onRemoveAction }
96+ dragHandle = { < EditableActionDragHandle overlay /> }
9897 onChange = { onChangeAction }
99- leadingSlot = {
100- < IconButton
101- size = "2"
102- variant = "ghost"
103- color = "gray"
104- aria-hidden
105- css = { css `
106- cursor : grabbing;
107- ` }
108- >
109- < GripVerticalIcon color = "gray" aria-hidden />
110- </ IconButton >
111- }
98+ onRemove = { onRemoveAction }
11299 />
113100 ) : null }
114101 </ DragOverlay >
@@ -178,23 +165,9 @@ function SortableEditableAction({
178165 >
179166 < EditableAction
180167 action = { action }
181- onRemove = { onRemove }
168+ dragHandle = { < EditableActionDragHandle { ... attributes } { ... listeners } /> }
182169 onChange = { onChange }
183- leadingSlot = {
184- < IconButton
185- size = "2"
186- variant = "ghost"
187- color = "gray"
188- aria-label = "Drag to reorder"
189- css = { css `
190- cursor : grab;
191- ` }
192- { ...attributes }
193- { ...listeners }
194- >
195- < GripVerticalIcon color = "gray" aria-hidden />
196- </ IconButton >
197- }
170+ onRemove = { onRemove }
198171 />
199172 </ Flex >
200173 )
0 commit comments