diff --git a/packages/components/CHANGELOG.md b/packages/components/CHANGELOG.md index 8d1dc8553ee8ed..6cbb61df763f14 100644 --- a/packages/components/CHANGELOG.md +++ b/packages/components/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +### Bug Fixes + +- `Notice`: Fix notice component spacing issue when actions are present. ([#69430](https://github.com/WordPress/gutenberg/pull/69430)) + ## 30.9.0 (2025-11-26) ### Bug Fixes @@ -21,7 +25,6 @@ - `NumberControl`: Fix crash when min prop is string and step prop contains decimal ([#73107](https://github.com/WordPress/gutenberg/pull/73107)). - `Modal`: Fix full-screen modal height to allow contents to scroll properly ([#73150](https://github.com/WordPress/gutenberg/pull/73150)). - ### Internal - `Modal`: Add a classname to simplify full height content modal styling ([#73108](https://github.com/WordPress/gutenberg/pull/73108)). diff --git a/packages/components/src/notice/index.tsx b/packages/components/src/notice/index.tsx index 6f3ca94d4f734a..ce08d3ccd2e75c 100644 --- a/packages/components/src/notice/index.tsx +++ b/packages/components/src/notice/index.tsx @@ -111,53 +111,60 @@ function Notice( { { getStatusLabel( status ) }
{ children } -
- { actions.map( - ( - { - className: buttonCustomClasses, - label, - isPrimary, - variant, - noDefaultClasses = false, - onClick, - url, - }: NoticeAction & - // `isPrimary` is a legacy prop included for - // backcompat, but `variant` should be used - // instead. - Pick< DeprecatedButtonProps, 'isPrimary' >, - index - ) => { - let computedVariant = variant; - if ( variant !== 'primary' && ! noDefaultClasses ) { - computedVariant = ! url ? 'secondary' : 'link'; - } - if ( - typeof computedVariant === 'undefined' && - isPrimary - ) { - computedVariant = 'primary'; - } + { actions.length > 0 && ( +
+ { actions.map( + ( + { + className: buttonCustomClasses, + label, + isPrimary, + variant, + noDefaultClasses = false, + onClick, + url, + }: NoticeAction & + // `isPrimary` is a legacy prop included for + // backcompat, but `variant` should be used + // instead. + Pick< DeprecatedButtonProps, 'isPrimary' >, + index + ) => { + let computedVariant = variant; + if ( + variant !== 'primary' && + ! noDefaultClasses + ) { + computedVariant = ! url + ? 'secondary' + : 'link'; + } + if ( + typeof computedVariant === 'undefined' && + isPrimary + ) { + computedVariant = 'primary'; + } - return ( - - ); - } - ) } -
+ return ( + + ); + } + ) } +
+ ) }
{ isDismissible && (