@@ -501,35 +501,37 @@ function Panel({
501501 const showResponsiveCancelSaveButtons =
502502 variant !== 'modal' && usingFullScreenOnNarrow && isMultiSelectVariant ( selected ) && onCancel !== undefined
503503
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 =
507509 variant !== 'modal' && usingFullScreenOnNarrow && isMultiSelectVariant ( selected ) && onCancel === undefined
508510
509511 // If there is any element in the footer, we render it.
510512 const renderFooter =
511513 secondaryAction !== undefined ||
512514 showPermanentCancelSaveButtons ||
513- showResponsiveSaveButton ||
515+ showResponsiveSaveAndCloseButton ||
514516 showResponsiveCancelSaveButtons
515517
516518 // If there's any permanent elements in the footer, we show it always.
517519 // The save button is only shown on small screens.
518520 const displayFooter =
519521 secondaryAction !== undefined || showPermanentCancelSaveButtons
520522 ? 'always'
521- : showResponsiveSaveButton || showResponsiveCancelSaveButtons
523+ : showResponsiveSaveAndCloseButton || showResponsiveCancelSaveButtons
522524 ? 'only-small'
523525 : undefined
524526
525527 const stretchSecondaryAction =
526- showResponsiveSaveButton || showResponsiveCancelSaveButtons
528+ showResponsiveSaveAndCloseButton || showResponsiveCancelSaveButtons
527529 ? 'only-big'
528530 : showPermanentCancelSaveButtons
529531 ? 'never'
530532 : 'always'
531533
532- const stretchSaveButton = showResponsiveSaveButton && secondaryAction === undefined ? 'only-small' : 'never'
534+ const stretchSaveButton = showResponsiveSaveAndCloseButton && secondaryAction === undefined ? 'only-small' : 'never'
533535
534536 return (
535537 < >
@@ -671,7 +673,7 @@ function Panel({
671673 </ Button >
672674 </ div >
673675 ) : null }
674- { showResponsiveSaveButton ? (
676+ { showResponsiveSaveAndCloseButton ? (
675677 < div className = { classes . ResponsiveSaveButton } data-stretch-save-button = { stretchSaveButton } >
676678 < Button
677679 block
@@ -681,7 +683,7 @@ function Panel({
681683 onClose ( 'click-outside' )
682684 } }
683685 >
684- Save
686+ Save and close
685687 </ Button >
686688 </ div >
687689 ) : null }
0 commit comments