@@ -501,35 +501,37 @@ function Panel({
501
501
const showResponsiveCancelSaveButtons =
502
502
variant !== 'modal' && usingFullScreenOnNarrow && isMultiSelectVariant ( selected ) && onCancel !== undefined
503
503
504
- // The responsive save button is only covering a very specific case:
505
- // - anchored panel with multi select if there is no onCancel
506
- const showResponsiveSaveButton =
504
+ // The responsive save and close button is only covering a very specific case:
505
+ // - anchored panel with multi select if there is no onCancel.
506
+ // This variant should disappear in the future, once onCancel is required,
507
+ // but for now we need to support it so there is a user friendly way to close the panel.
508
+ const showResponsiveSaveAndCloseButton =
507
509
variant !== 'modal' && usingFullScreenOnNarrow && isMultiSelectVariant ( selected ) && onCancel === undefined
508
510
509
511
// If there is any element in the footer, we render it.
510
512
const renderFooter =
511
513
secondaryAction !== undefined ||
512
514
showPermanentCancelSaveButtons ||
513
- showResponsiveSaveButton ||
515
+ showResponsiveSaveAndCloseButton ||
514
516
showResponsiveCancelSaveButtons
515
517
516
518
// If there's any permanent elements in the footer, we show it always.
517
519
// The save button is only shown on small screens.
518
520
const displayFooter =
519
521
secondaryAction !== undefined || showPermanentCancelSaveButtons
520
522
? 'always'
521
- : showResponsiveSaveButton || showResponsiveCancelSaveButtons
523
+ : showResponsiveSaveAndCloseButton || showResponsiveCancelSaveButtons
522
524
? 'only-small'
523
525
: undefined
524
526
525
527
const stretchSecondaryAction =
526
- showResponsiveSaveButton || showResponsiveCancelSaveButtons
528
+ showResponsiveSaveAndCloseButton || showResponsiveCancelSaveButtons
527
529
? 'only-big'
528
530
: showPermanentCancelSaveButtons
529
531
? 'never'
530
532
: 'always'
531
533
532
- const stretchSaveButton = showResponsiveSaveButton && secondaryAction === undefined ? 'only-small' : 'never'
534
+ const stretchSaveButton = showResponsiveSaveAndCloseButton && secondaryAction === undefined ? 'only-small' : 'never'
533
535
534
536
return (
535
537
< >
@@ -671,7 +673,7 @@ function Panel({
671
673
</ Button >
672
674
</ div >
673
675
) : null }
674
- { showResponsiveSaveButton ? (
676
+ { showResponsiveSaveAndCloseButton ? (
675
677
< div className = { classes . ResponsiveSaveButton } data-stretch-save-button = { stretchSaveButton } >
676
678
< Button
677
679
block
@@ -681,7 +683,7 @@ function Panel({
681
683
onClose ( 'click-outside' )
682
684
} }
683
685
>
684
- Save
686
+ Save and close
685
687
</ Button >
686
688
</ div >
687
689
) : null }
0 commit comments