@@ -167,13 +167,14 @@ export const TableWrapper = styled.table<{
167
167
} ,
168
168
} ) ) ;
169
169
170
- const StyledIconButton = styled ( IconButton as any ) ( ( { theme } ) => ( {
171
- margin : '-4px -12px -4px 0 ' ,
172
- } ) ) ;
170
+ const TablePositionWrapper = styled . div ( {
171
+ position : 'relative ' ,
172
+ } ) ;
173
173
174
- const ControlHeadingWrapper = styled . span ( {
175
- display : 'flex' ,
176
- justifyContent : 'space-between' ,
174
+ const ButtonPositionWrapper = styled . div ( {
175
+ position : 'absolute' ,
176
+ right : 8 ,
177
+ top : 6 ,
177
178
} ) ;
178
179
179
180
export enum ArgsTableError {
@@ -380,82 +381,94 @@ export const ArgsTable: FC<ArgsTableProps> = (props) => {
380
381
381
382
return (
382
383
< ResetWrapper >
383
- < TableWrapper { ...{ compact, inAddonPanel } } className = "docblock-argstable sb-unstyled" >
384
- < thead className = "docblock-argstable-head" >
385
- < tr >
386
- < th >
387
- < span > Name</ span >
388
- </ th >
389
- { compact ? null : (
390
- < th >
391
- < span > Description</ span >
392
- </ th >
393
- ) }
394
- { compact ? null : (
395
- < th >
396
- < span > Default</ span >
397
- </ th >
398
- ) }
399
- { updateArgs ? (
384
+ < TablePositionWrapper >
385
+ { updateArgs && ! isLoading && resetArgs && (
386
+ < ButtonPositionWrapper >
387
+ < IconButton
388
+ onClick = { ( ) => resetArgs ( ) }
389
+ aria-label = "Reset controls"
390
+ title = "Reset controls"
391
+ >
392
+ < UndoIcon />
393
+ </ IconButton >
394
+ </ ButtonPositionWrapper >
395
+ ) }
396
+
397
+ < TableWrapper { ...{ compact, inAddonPanel } } className = "docblock-argstable sb-unstyled" >
398
+ < thead className = "docblock-argstable-head" >
399
+ < tr >
400
400
< th >
401
- < ControlHeadingWrapper >
402
- Control{ ' ' }
403
- { ! isLoading && resetArgs && (
404
- < StyledIconButton onClick = { ( ) => resetArgs ( ) } title = "Reset controls" >
405
- < UndoIcon aria-hidden />
406
- </ StyledIconButton >
407
- ) }
408
- </ ControlHeadingWrapper >
401
+ < span > Name</ span >
409
402
</ th >
410
- ) : null }
411
- </ tr >
412
- </ thead >
413
- < tbody className = "docblock-argstable-body" >
414
- { groups . ungrouped . map ( ( row ) => (
415
- < ArgRow key = { row . key } row = { row } arg = { args && args [ row . key ] } { ...common } />
416
- ) ) }
417
-
418
- { Object . entries ( groups . ungroupedSubsections ) . map ( ( [ subcategory , subsection ] ) => (
419
- < SectionRow key = { subcategory } label = { subcategory } level = "subsection" colSpan = { colSpan } >
420
- { subsection . map ( ( row ) => (
421
- < ArgRow
422
- key = { row . key }
423
- row = { row }
424
- arg = { args && args [ row . key ] }
425
- expandable = { expandable }
426
- { ...common }
427
- />
428
- ) ) }
429
- </ SectionRow >
430
- ) ) }
431
-
432
- { Object . entries ( groups . sections ) . map ( ( [ category , section ] ) => (
433
- < SectionRow key = { category } label = { category } level = "section" colSpan = { colSpan } >
434
- { section . ungrouped . map ( ( row ) => (
435
- < ArgRow key = { row . key } row = { row } arg = { args && args [ row . key ] } { ...common } />
436
- ) ) }
437
- { Object . entries ( section . subsections ) . map ( ( [ subcategory , subsection ] ) => (
438
- < SectionRow
439
- key = { subcategory }
440
- label = { subcategory }
441
- level = "subsection"
442
- colSpan = { colSpan }
443
- >
444
- { subsection . map ( ( row ) => (
445
- < ArgRow
446
- key = { row . key }
447
- row = { row }
448
- arg = { args && args [ row . key ] }
449
- expandable = { expandable }
450
- { ...common }
451
- />
452
- ) ) }
453
- </ SectionRow >
454
- ) ) }
455
- </ SectionRow >
456
- ) ) }
457
- </ tbody >
458
- </ TableWrapper >
403
+ { compact ? null : (
404
+ < th >
405
+ < span > Description</ span >
406
+ </ th >
407
+ ) }
408
+ { compact ? null : (
409
+ < th >
410
+ < span > Default</ span >
411
+ </ th >
412
+ ) }
413
+ { updateArgs ? (
414
+ < th >
415
+ < span > Control</ span >
416
+ </ th >
417
+ ) : null }
418
+ </ tr >
419
+ </ thead >
420
+ < tbody className = "docblock-argstable-body" >
421
+ { groups . ungrouped . map ( ( row ) => (
422
+ < ArgRow key = { row . key } row = { row } arg = { args && args [ row . key ] } { ...common } />
423
+ ) ) }
424
+
425
+ { Object . entries ( groups . ungroupedSubsections ) . map ( ( [ subcategory , subsection ] ) => (
426
+ < SectionRow
427
+ key = { subcategory }
428
+ label = { subcategory }
429
+ level = "subsection"
430
+ colSpan = { colSpan }
431
+ >
432
+ { subsection . map ( ( row ) => (
433
+ < ArgRow
434
+ key = { row . key }
435
+ row = { row }
436
+ arg = { args && args [ row . key ] }
437
+ expandable = { expandable }
438
+ { ...common }
439
+ />
440
+ ) ) }
441
+ </ SectionRow >
442
+ ) ) }
443
+
444
+ { Object . entries ( groups . sections ) . map ( ( [ category , section ] ) => (
445
+ < SectionRow key = { category } label = { category } level = "section" colSpan = { colSpan } >
446
+ { section . ungrouped . map ( ( row ) => (
447
+ < ArgRow key = { row . key } row = { row } arg = { args && args [ row . key ] } { ...common } />
448
+ ) ) }
449
+ { Object . entries ( section . subsections ) . map ( ( [ subcategory , subsection ] ) => (
450
+ < SectionRow
451
+ key = { subcategory }
452
+ label = { subcategory }
453
+ level = "subsection"
454
+ colSpan = { colSpan }
455
+ >
456
+ { subsection . map ( ( row ) => (
457
+ < ArgRow
458
+ key = { row . key }
459
+ row = { row }
460
+ arg = { args && args [ row . key ] }
461
+ expandable = { expandable }
462
+ { ...common }
463
+ />
464
+ ) ) }
465
+ </ SectionRow >
466
+ ) ) }
467
+ </ SectionRow >
468
+ ) ) }
469
+ </ tbody >
470
+ </ TableWrapper >
471
+ </ TablePositionWrapper >
459
472
</ ResetWrapper >
460
473
) ;
461
474
} ;
0 commit comments