File tree Expand file tree Collapse file tree 3 files changed +2
-60
lines changed
packages/gui/src/components Expand file tree Collapse file tree 3 files changed +2
-60
lines changed Original file line number Diff line number Diff line change 1
- import produce from 'immer'
2
1
import { useState } from 'react'
3
- import { flip , replace , remove , insert } from '../lib/array'
2
+ import { replace , remove , insert } from '../lib/array'
4
3
import { EditorPropsWithLabel } from '../types/editor'
5
4
import { SchemaInput } from './inputs/SchemaInput'
6
5
import { DataTypeSchema } from './schemas/types'
@@ -21,13 +20,6 @@ export default function FieldArray<T>(props: FieldArrayProps<T>) {
21
20
const [ dragIndex , setDragIndex ] = useState ( - 1 )
22
21
const isDragging = dragIndex >= 0
23
22
24
- const handleReorder = ( i1 : number , i2 : number ) => {
25
- if ( typeof value === 'string' ) {
26
- return
27
- }
28
- onChange ( flip ( value , i1 , i2 ) )
29
- }
30
-
31
23
const handleDragDrop = ( i1 : number , i2 : number ) => {
32
24
const item = value [ i1 ]
33
25
const removed = remove ( value , i1 )
@@ -74,20 +66,6 @@ export default function FieldArray<T>(props: FieldArrayProps<T>) {
74
66
onDragEnd = { ( ) => {
75
67
setDragIndex ( - 1 )
76
68
} }
77
- reorder = { {
78
- onMoveUp :
79
- i === 0
80
- ? undefined
81
- : ( ) => {
82
- handleReorder ( i , i - 1 )
83
- } ,
84
- onMoveDown :
85
- i === value . length - 1
86
- ? undefined
87
- : ( ) => {
88
- handleReorder ( i , i + 1 )
89
- } ,
90
- } }
91
69
/>
92
70
</ div >
93
71
</ div >
Original file line number Diff line number Diff line change @@ -14,10 +14,6 @@ interface Props<T> {
14
14
onRemove ?( ) : void
15
15
onDrag ?( ) : void
16
16
onDragEnd ?( ) : void
17
- reorder ?: {
18
- onMoveUp ?( ) : void
19
- onMoveDown ?( ) : void
20
- }
21
17
}
22
18
23
19
/**
Original file line number Diff line number Diff line change 1
1
import { ReactNode } from 'react'
2
- import {
3
- AlignJustify ,
4
- ChevronDown ,
5
- ChevronUp ,
6
- RefreshCw ,
7
- X ,
8
- } from 'react-feather'
2
+ import { AlignJustify , RefreshCw , X } from 'react-feather'
9
3
import { EditorPropsWithLabel } from '../../types/editor'
10
4
import { Label } from '../primitives'
11
5
import { useTheme } from '../providers/ThemeContext'
@@ -16,10 +10,6 @@ interface Props extends Omit<EditorPropsWithLabel<any>, 'keywords'> {
16
10
regenerate ?( options : any ) : any
17
11
onDrag ?( ) : void
18
12
onDragEnd ?( ) : void
19
- reorder ?: {
20
- onMoveUp ?( ) : void
21
- onMoveDown ?( ) : void
22
- }
23
13
}
24
14
25
15
export function InputHeader ( {
@@ -31,7 +21,6 @@ export function InputHeader({
31
21
onDrag,
32
22
onDragEnd,
33
23
regenerate,
34
- reorder,
35
24
ruleset,
36
25
property,
37
26
} : Props ) {
@@ -72,27 +61,6 @@ export function InputHeader({
72
61
</ IconButton >
73
62
) }
74
63
{ onRemove && < DeleteButton onRemove = { onRemove } /> }
75
- { reorder && (
76
- < div
77
- sx = { {
78
- display : 'flex' ,
79
- flexDirection : 'column' ,
80
- justifySelf : 'right' ,
81
- alignSelf : 'center' ,
82
- gap : '-0.5rem' ,
83
- } }
84
- >
85
- < IconButton disabled = { ! reorder . onMoveUp } onClick = { reorder . onMoveUp } >
86
- < ChevronUp size = { 16 } />
87
- </ IconButton >
88
- < IconButton
89
- disabled = { ! reorder . onMoveDown }
90
- onClick = { reorder . onMoveDown }
91
- >
92
- < ChevronDown size = { 16 } />
93
- </ IconButton >
94
- </ div >
95
- ) }
96
64
</ div >
97
65
</ div >
98
66
)
You can’t perform that action at this time.
0 commit comments