Skip to content

Commit 14d10ea

Browse files
juanfraMamadukajameskoster
authored
List View: Use badge component for block anchors (#68566)
Co-authored-by: juanfra <[email protected]> Co-authored-by: Mamaduka <[email protected]> Co-authored-by: jameskoster <[email protected]>
1 parent 79234bd commit 14d10ea

File tree

2 files changed

+6
-10
lines changed

2 files changed

+6
-10
lines changed

packages/block-editor/src/components/list-view/block-select-button.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ import clsx from 'clsx';
99
import {
1010
__experimentalHStack as HStack,
1111
__experimentalTruncate as Truncate,
12+
privateApis as componentsPrivateApis,
1213
} from '@wordpress/components';
1314
import { forwardRef } from '@wordpress/element';
1415
import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
@@ -25,6 +26,8 @@ import ListViewExpander from './expander';
2526
import { useBlockLock } from '../block-lock';
2627
import useListViewImages from './use-list-view-images';
2728
import { store as blockEditorStore } from '../../store';
29+
import { unlock } from '../../lock-unlock';
30+
const { Badge } = unlock( componentsPrivateApis );
2831

2932
function ListViewBlockSelectButton(
3033
{
@@ -117,12 +120,9 @@ function ListViewBlockSelectButton(
117120
</span>
118121
{ blockInformation?.anchor && (
119122
<span className="block-editor-list-view-block-select-button__anchor-wrapper">
120-
<Truncate
121-
className="block-editor-list-view-block-select-button__anchor"
122-
ellipsizeMode="auto"
123-
>
123+
<Badge className="block-editor-list-view-block-select-button__anchor">
124124
{ blockInformation.anchor }
125-
</Truncate>
125+
</Badge>
126126
</span>
127127
) }
128128
{ isSticky && (

packages/block-editor/src/components/list-view/style.scss

+1-5
Original file line numberDiff line numberDiff line change
@@ -408,15 +408,11 @@
408408
position: absolute;
409409
right: 0;
410410
transform: translateY(-50%);
411-
background: rgba($black, 0.1);
412-
border-radius: $radius-x-small;
413-
padding: 2px 6px;
414-
max-width: 100%;
415-
box-sizing: border-box;
416411
}
417412

418413
&.is-selected .block-editor-list-view-block-select-button__anchor {
419414
background: rgba($black, 0.3);
415+
color: $white;
420416
}
421417

422418
.block-editor-list-view-block-select-button__lock,

0 commit comments

Comments
 (0)