@@ -27,8 +27,8 @@ const Item = SortableElement((props) => {
27
27
< div className = { props . className } style = { {
28
28
height : props . height
29
29
} } >
30
+ { props . shouldUseDragHandle && < Handle /> }
30
31
< div className = { style . wrapper } >
31
- { props . useDragHandle && < Handle /> }
32
32
< span > Item</ span > { props . value }
33
33
</ div >
34
34
</ div >
@@ -50,7 +50,8 @@ class ListWrapper extends Component {
50
50
height : PropTypes . number ,
51
51
onSortStart : PropTypes . func ,
52
52
onSortEnd : PropTypes . func ,
53
- component : PropTypes . func
53
+ component : PropTypes . func ,
54
+ shouldUseDragHandle : PropTypes . bool
54
55
}
55
56
static defaultProps = {
56
57
className : classNames ( style . list , style . stylizedList ) ,
@@ -80,10 +81,12 @@ class ListWrapper extends Component {
80
81
const Component = this . props . component ;
81
82
const { items, isSorting} = this . state ;
82
83
const props = {
83
- isSorting, items,
84
+ isSorting,
85
+ items,
84
86
onSortEnd : this . onSortEnd ,
85
87
onSortStart : this . onSortStart ,
86
- ref : "component"
88
+ ref : "component" ,
89
+ useDragHandle : this . props . shouldUseDragHandle
87
90
}
88
91
89
92
return < Component { ...this . props } { ...props } />
@@ -200,7 +203,7 @@ const SortableInfiniteList = SortableContainer(({className, items, itemClass, so
200
203
)
201
204
} ) ;
202
205
203
- const SortableList = SortableContainer ( ( { className, items, itemClass, sortingIndex, useDragHandle , sortableHandlers} ) => {
206
+ const SortableList = SortableContainer ( ( { className, items, itemClass, sortingIndex, shouldUseDragHandle , sortableHandlers} ) => {
204
207
return (
205
208
< div className = { className } { ...sortableHandlers } >
206
209
{ items . map ( ( { value, height} , index ) =>
@@ -211,14 +214,14 @@ const SortableList = SortableContainer(({className, items, itemClass, sortingInd
211
214
index = { index }
212
215
value = { value }
213
216
height = { height }
214
- useDragHandle = { useDragHandle }
217
+ shouldUseDragHandle = { shouldUseDragHandle }
215
218
/>
216
219
) }
217
220
</ div >
218
221
) ;
219
222
} ) ;
220
223
221
- const ShrinkingSortableList = SortableContainer ( ( { className, isSorting, items, itemClass, sortingIndex, useDragHandle , sortableHandlers} ) => {
224
+ const ShrinkingSortableList = SortableContainer ( ( { className, isSorting, items, itemClass, sortingIndex, shouldUseDragHandle , sortableHandlers} ) => {
222
225
return (
223
226
< div className = { className } { ...sortableHandlers } >
224
227
{ items . map ( ( { value, height} , index ) =>
@@ -229,8 +232,8 @@ const ShrinkingSortableList = SortableContainer(({className, isSorting, items, i
229
232
index = { index }
230
233
value = { value }
231
234
height = { isSorting ? 20 : height }
232
- useDragHandle = { useDragHandle }
233
- />
235
+ shouldUseDragHandle = { shouldUseDragHandle }
236
+ />
234
237
) }
235
238
</ div >
236
239
) ;
@@ -247,7 +250,7 @@ storiesOf('Basic Configuration', module)
247
250
. add ( 'Drag handle' , ( ) => {
248
251
return (
249
252
< div className = { style . root } >
250
- < ListWrapper component = { SortableList } useDragHandle = { true } items = { getItems ( 50 , 59 ) } helperClass = { style . stylizedHelper } />
253
+ < ListWrapper component = { SortableList } shouldUseDragHandle = { true } items = { getItems ( 50 , 59 ) } helperClass = { style . stylizedHelper } />
251
254
</ div >
252
255
) ;
253
256
} )
0 commit comments