Skip to content

Commit f5f34d5

Browse files
committed
refactor and fix bug in ordering
1 parent 262a37b commit f5f34d5

File tree

1 file changed

+2
-8
lines changed
  • packages/frontend/src/components/SortableList/components/SortableItem

1 file changed

+2
-8
lines changed

packages/frontend/src/components/SortableList/components/SortableItem/index.tsx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import './SortableItem.css'
22

33
import type { CSSProperties, PropsWithChildren } from 'react'
4-
import { createContext, useContext, useMemo } from 'react'
4+
import React, { createContext, useContext, useMemo } from 'react'
55
import type {
66
DraggableSyntheticListeners,
77
UniqueIdentifier,
@@ -76,13 +76,7 @@ export function DragHandle(props: { onWarningOpen?: () => void }) {
7676
{...attributes}
7777
{...listeners}
7878
ref={ref}
79-
onPointerDown={() => {
80-
if (shouldWarnOnLeave) {
81-
onWarningOpen?.()
82-
} else {
83-
listeners?.onPointerDown?.()
84-
}
85-
}}
79+
{...(shouldWarnOnLeave && { onPointerDown: onWarningOpen })}
8680
>
8781
<svg viewBox="0 0 20 20" width="12">
8882
<path d="M7 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 2zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 7 14zm6-8a2 2 0 1 0-.001-4.001A2 2 0 0 0 13 6zm0 2a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 8zm0 6a2 2 0 1 0 .001 4.001A2 2 0 0 0 13 14z"></path>

0 commit comments

Comments
 (0)