diff --git a/packages/block-editor/CHANGELOG.md b/packages/block-editor/CHANGELOG.md index 051082788e23d8..1e040146231bdc 100644 --- a/packages/block-editor/CHANGELOG.md +++ b/packages/block-editor/CHANGELOG.md @@ -20,6 +20,7 @@ - `LinkControl`, `LinkPicker`: migrate the link preview badges from the private `@wordpress/components` `Badge` to `@wordpress/ui` `Badge` ([#82684](https://github.com/WordPress/gutenberg/pull/82684)). - `BlockQuickNavigation`: Highlight a block on the canvas while its item is hovered or focused, matching the List View. This affects the inspector Content tab, the pattern overrides panel, and the template and template part content panels ([#83049](https://github.com/WordPress/gutenberg/pull/83049)). - Inserter and pattern search: rank title matches above keyword and description matches, and rank a word in the title that starts with the search term above a substring match ([#83312](https://github.com/WordPress/gutenberg/pull/83312)). +- `ViewportVisibilityInfo`: Migrate the block visibility badge from the private `@wordpress/components` `Badge` to `@wordpress/ui` `Notice` component ([#82670](https://github.com/WordPress/gutenberg/pull/82670)). ### Bug Fixes diff --git a/packages/block-editor/src/components/block-visibility/style.scss b/packages/block-editor/src/components/block-visibility/style.scss index 7d66c28f05de21..4f6860d39a2573 100644 --- a/packages/block-editor/src/components/block-visibility/style.scss +++ b/packages/block-editor/src/components/block-visibility/style.scss @@ -49,10 +49,5 @@ } .block-editor-block-visibility-info { - padding-top: $grid-unit-05; - padding-bottom: $grid-unit-05; margin: 0 $grid-unit-20 $grid-unit-20; - display: flex; - align-items: center; - justify-content: start; } diff --git a/packages/block-editor/src/components/block-visibility/viewport-visibility-info.jsx b/packages/block-editor/src/components/block-visibility/viewport-visibility-info.jsx index 012e3b3003fc94..0c6e5e4f6948bd 100644 --- a/packages/block-editor/src/components/block-visibility/viewport-visibility-info.jsx +++ b/packages/block-editor/src/components/block-visibility/viewport-visibility-info.jsx @@ -1,12 +1,8 @@ -import { - Icon as WCIcon, - __experimentalText as WCText, - __experimentalHStack as HStack, - privateApis as componentsPrivateApis, -} from '@wordpress/components'; import { useSelect } from '@wordpress/data'; import { __, sprintf } from '@wordpress/i18n'; import { unseen } from '@wordpress/icons'; +// eslint-disable-next-line @wordpress/use-recommended-components +import { Notice } from '@wordpress/ui'; import { unlock } from '../../lock-unlock'; import { store as blockEditorStore } from '../../store'; import useBlockVisibility from './use-block-visibility'; @@ -14,7 +10,6 @@ import { useBlockElement } from '../block-list/use-block-props/use-block-refs'; import { deviceTypeKey } from '../../store/private-keys'; import { BLOCK_VISIBILITY_VIEWPORTS } from './constants'; -const { Badge: WCBadge } = unlock( componentsPrivateApis ); const DEFAULT_VISIBILITY_STATE = { currentBlockVisibility: undefined, hasParentHiddenEverywhere: false, @@ -95,14 +90,14 @@ export default function ViewportVisibilityInfo( { clientId } ) { if ( isBlockCurrentlyHidden ) { // Block is currently hidden - check if hidden everywhere or at specific viewport if ( currentBlockVisibility === false ) { - label = __( 'Block is hidden' ); + label = __( 'Hidden' ); } else { const viewportLabel = BLOCK_VISIBILITY_VIEWPORTS[ currentViewport ]?.label || currentViewport; label = sprintf( /* translators: %s: viewport name (Desktop, Tablet, Mobile) */ - __( 'Block is hidden on %s' ), + __( 'Hidden on %s' ), viewportLabel ); } @@ -110,24 +105,25 @@ export default function ViewportVisibilityInfo( { clientId } ) { // Parent is hidden - check if hidden everywhere or at specific viewport if ( hasParentHiddenEverywhere ) { - label = __( 'Parent block is hidden' ); + label = __( 'Parent hidden' ); } else if ( isBlockParentHiddenAtViewport ) { const viewportLabel = BLOCK_VISIBILITY_VIEWPORTS[ currentViewport ]?.label || currentViewport; label = sprintf( /* translators: %s: viewport name (Desktop, Tablet, Mobile) */ - __( 'Parent block is hidden on %s' ), + __( 'Parent hidden on %s' ), viewportLabel ); } return ( - - - - { label } - - + + { label } + ); } diff --git a/test/e2e/specs/editor/various/block-hiding.spec.js b/test/e2e/specs/editor/various/block-hiding.spec.js index 028a513f18b0c8..90309d5ee09d36 100644 --- a/test/e2e/specs/editor/various/block-hiding.spec.js +++ b/test/e2e/specs/editor/various/block-hiding.spec.js @@ -49,11 +49,11 @@ test.describe( 'Block Hiding', () => { // Open the settings sidebar. await editor.openDocumentSettingsSidebar(); - // Verify the block inspector shows "Block is hidden". + // Verify the block inspector shows "Hidden". await expect( page .getByRole( 'region', { name: 'Editor settings' } ) - .getByText( 'Block is hidden' ) + .getByText( 'Hidden', { exact: true } ) ).toBeVisible(); // Verify the Options menu now shows "Show" instead of "Hide". @@ -222,11 +222,11 @@ test.describe( 'Block Hiding', () => { // Open the settings sidebar. await editor.openDocumentSettingsSidebar(); - // Verify the block inspector shows "Block is hidden on Mobile". + // Verify the block inspector shows "Hidden on Mobile". await expect( page .getByRole( 'region', { name: 'Editor settings' } ) - .getByText( 'Block is hidden on Mobile' ) + .getByText( 'Hidden on Mobile' ) ).toBeVisible(); // Verify the Options menu now shows "Show" instead of "Hide". diff --git a/tools/eslint/suppressions.json b/tools/eslint/suppressions.json index c0dc1c90a0e169..bfeb746ce0727a 100644 --- a/tools/eslint/suppressions.json +++ b/tools/eslint/suppressions.json @@ -808,9 +808,6 @@ } }, "packages/block-editor/src/components/block-visibility/viewport-visibility-info.jsx": { - "@wordpress/use-recommended-components": { - "count": 2 - }, "react/jsx-filename-extension": { "count": 1 }