@@ -35,6 +35,15 @@ function ArrayFieldDescription({DescriptionField, idSchema, description}) {
35
35
return < DescriptionField id = { id } description = { description } /> ;
36
36
}
37
37
38
+ function IconBtn ( props ) {
39
+ const { type= "default" , icon, className, ...otherProps } = props ;
40
+ return (
41
+ < button type = "button" className = { `btn btn-${ type } ${ className } ` } { ...otherProps } >
42
+ < i className = { `glyphicon glyphicon-${ icon } ` } />
43
+ </ button >
44
+ ) ;
45
+ }
46
+
38
47
class ArrayField extends Component {
39
48
static defaultProps = {
40
49
uiSchema : { } ,
@@ -349,7 +358,7 @@ class ArrayField extends Component {
349
358
350
359
return (
351
360
< div key = { index } className = "array-item" >
352
- < div className = { hasToolbar ? "col-xs-10 " : "col-xs-12" } >
361
+ < div className = { hasToolbar ? "col-xs-9 " : "col-xs-12" } >
353
362
< SchemaField
354
363
schema = { itemSchema }
355
364
uiSchema = { itemUiSchema }
@@ -365,28 +374,28 @@ class ArrayField extends Component {
365
374
</ div >
366
375
{
367
376
hasToolbar ?
368
- < div className = "col-xs-2 array-item-toolbox text-right " >
369
- < div className = "btn-group" style = { { display : "flex" } } >
377
+ < div className = "col-xs-3 array-item-toolbox" >
378
+ < div className = "btn-group" style = { { display : "flex" , justifyContent : "space-around" } } >
370
379
{ _canMoveUp || _canMoveDown ?
371
- < button type = "button" className = "btn btn-default array-item-move-up"
372
- style = { btnStyle }
380
+ < IconBtn icon = "arrow-up" className = "array-item-move-up"
373
381
tabIndex = "-1"
382
+ style = { btnStyle }
374
383
disabled = { disabled || readonly || ! _canMoveUp }
375
- onClick = { this . onReorderClick ( index , index - 1 ) } > ⬆ </ button >
384
+ onClick = { this . onReorderClick ( index , index - 1 ) } / >
376
385
: null }
377
386
{ _canMoveUp || _canMoveDown ?
378
- < button type = "button" className = "btn btn-default array-item-move-down"
379
- style = { btnStyle }
387
+ < IconBtn icon = "arrow-down" className = "array-item-move-down"
380
388
tabIndex = "-1"
389
+ style = { btnStyle }
381
390
disabled = { disabled || readonly || ! _canMoveDown }
382
- onClick = { this . onReorderClick ( index , index + 1 ) } > ⬇ </ button >
391
+ onClick = { this . onReorderClick ( index , index + 1 ) } / >
383
392
: null }
384
393
{ removable ?
385
- < button type = "button" className = "btn btn-danger array-item-remove"
386
- style = { btnStyle }
394
+ < IconBtn type = "danger" icon = "remove" className = "array-item-remove"
387
395
tabIndex = "-1"
396
+ style = { btnStyle }
388
397
disabled = { disabled || readonly }
389
- onClick = { this . onDropIndexClick ( index ) } > ✖ </ button >
398
+ onClick = { this . onDropIndexClick ( index ) } / >
390
399
: null }
391
400
</ div >
392
401
</ div >
@@ -400,10 +409,10 @@ class ArrayField extends Component {
400
409
function AddButton ( { onClick, disabled} ) {
401
410
return (
402
411
< div className = "row" >
403
- < p className = "col-xs-2 col-xs-offset-10 array-item-add text-right" >
404
- < button type = "button" className = "btn btn-info col-xs-12"
405
- tabIndex = "-1" onClick = { onClick }
406
- disabled = { disabled } style = { { fontWeight : "bold" } } > ➕ </ button >
412
+ < p className = "col-xs-3 col-xs-offset-9 array-item-add text-right" >
413
+ < IconBtn type = "info" icon = "plus" className = "btn-add col-xs-12"
414
+ tabIndex = "-1" onClick = { onClick }
415
+ disabled = { disabled } / >
407
416
</ p >
408
417
</ div >
409
418
) ;
0 commit comments