From ec681ff31bce36aca02cc6a9128fa7ebdcae92ca Mon Sep 17 00:00:00 2001 From: Juan Aldasoro Date: Thu, 19 Dec 2024 16:13:21 +0100 Subject: [PATCH] Use Badge component in page markers (#68103) * Use Badge component in page markers * Remove redundant prop. * Remove import. * Fix the title alignment. Co-authored-by: juanfra Co-authored-by: tyxla Co-authored-by: jameskoster --- .../src/components/post-card-panel/index.js | 10 ++++++---- .../src/components/post-card-panel/style.scss | 17 ++++------------- .../fields/src/fields/page-title/style.scss | 10 ---------- packages/fields/src/fields/page-title/view.tsx | 7 +++++-- packages/fields/src/style.scss | 1 - 5 files changed, 15 insertions(+), 30 deletions(-) delete mode 100644 packages/fields/src/fields/page-title/style.scss diff --git a/packages/editor/src/components/post-card-panel/index.js b/packages/editor/src/components/post-card-panel/index.js index 7849f014ab49c..78f9522ba5f44 100644 --- a/packages/editor/src/components/post-card-panel/index.js +++ b/packages/editor/src/components/post-card-panel/index.js @@ -6,6 +6,7 @@ import { __experimentalHStack as HStack, __experimentalVStack as VStack, __experimentalText as Text, + privateApis as componentsPrivateApis, } from '@wordpress/components'; import { store as coreStore } from '@wordpress/core-data'; import { useSelect } from '@wordpress/data'; @@ -25,6 +26,7 @@ import { unlock } from '../../lock-unlock'; import PostActions from '../post-actions'; import usePageTypeBadge from '../../utils/pageTypeBadge'; import { getTemplateInfo } from '../../utils/get-template-info'; +const { Badge } = unlock( componentsPrivateApis ); /** * Renders a title of the post type and the available quick actions available within a 3-dot dropdown. @@ -109,11 +111,11 @@ export default function PostCardPanel( { className="editor-post-card-panel__title" as="h2" > - { title } + + { title } + { pageTypeBadge && postIds.length === 1 && ( - - { pageTypeBadge } - + { pageTypeBadge } ) } { @@ -27,11 +30,11 @@ export default function PageTitleView( { item }: { item: CommonPost } ) { return ( { [ frontPageId, postsPageId ].includes( item.id as number ) && ( - + { item.id === frontPageId ? __( 'Homepage' ) : __( 'Posts Page' ) } - + ) } ); diff --git a/packages/fields/src/style.scss b/packages/fields/src/style.scss index d9a571270fbb6..96b1f816de5b6 100644 --- a/packages/fields/src/style.scss +++ b/packages/fields/src/style.scss @@ -3,5 +3,4 @@ @import "./fields/featured-image/style.scss"; @import "./fields/template/style.scss"; @import "./fields/title/style.scss"; -@import "./fields/page-title/style.scss"; @import "./fields/pattern-title/style.scss";