Skip to content

Commit

Permalink
Use badge component for anchors in list view
Browse files Browse the repository at this point in the history
  • Loading branch information
juanfra committed Jan 9, 2025
1 parent e746a95 commit cf53870
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import clsx from 'clsx';
import {
__experimentalHStack as HStack,
__experimentalTruncate as Truncate,
privateApis as componentsPrivateApis,
} from '@wordpress/components';
import { forwardRef } from '@wordpress/element';
import { Icon, lockSmall as lock, pinSmall } from '@wordpress/icons';
Expand All @@ -25,6 +26,8 @@ import ListViewExpander from './expander';
import { useBlockLock } from '../block-lock';
import useListViewImages from './use-list-view-images';
import { store as blockEditorStore } from '../../store';
import { unlock } from '../../lock-unlock';
const { Badge } = unlock( componentsPrivateApis );

function ListViewBlockSelectButton(
{
Expand Down Expand Up @@ -117,12 +120,9 @@ function ListViewBlockSelectButton(
</span>
{ blockInformation?.anchor && (
<span className="block-editor-list-view-block-select-button__anchor-wrapper">
<Truncate
className="block-editor-list-view-block-select-button__anchor"
ellipsizeMode="auto"
>
<Badge className="block-editor-list-view-block-select-button__anchor">
{ blockInformation.anchor }
</Truncate>
</Badge>
</span>
) }
{ isSticky && (
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/components/list-view/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@

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

.block-editor-list-view-block-select-button__lock,
Expand Down

0 comments on commit cf53870

Please sign in to comment.