From 5d4bf270bf0abf21bb0eee8f92ddd4f2b35ef299 Mon Sep 17 00:00:00 2001 From: Nik Tsekouras Date: Fri, 19 Jul 2024 09:14:10 +0300 Subject: [PATCH] Add post status icon in post summary (#63658) Co-authored-by: ntsekouras Co-authored-by: jameskoster --- .../components/post-last-revision/index.js | 1 + .../src/components/post-panel-row/style.scss | 1 - .../src/components/post-status/index.js | 28 ++++++++++++------- 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/packages/editor/src/components/post-last-revision/index.js b/packages/editor/src/components/post-last-revision/index.js index 73bcb7c0e026f9..d0f94e26048d77 100644 --- a/packages/editor/src/components/post-last-revision/index.js +++ b/packages/editor/src/components/post-last-revision/index.js @@ -64,6 +64,7 @@ export function PrivatePostLastRevision() { className="editor-private-post-last-revision__button" text={ revisionsCount } variant="tertiary" + size="compact" /> diff --git a/packages/editor/src/components/post-panel-row/style.scss b/packages/editor/src/components/post-panel-row/style.scss index 53e0c645f6f069..f76c586850500e 100644 --- a/packages/editor/src/components/post-panel-row/style.scss +++ b/packages/editor/src/components/post-panel-row/style.scss @@ -28,7 +28,6 @@ white-space: normal; text-wrap: balance; // Fallback for Safari. text-wrap: pretty; - height: auto; min-height: $button-size-compact; } diff --git a/packages/editor/src/components/post-status/index.js b/packages/editor/src/components/post-status/index.js index aacb933e1864ec..11b51bca80aa79 100644 --- a/packages/editor/src/components/post-status/index.js +++ b/packages/editor/src/components/post-status/index.js @@ -16,6 +16,13 @@ import { useState, useMemo } from '@wordpress/element'; import { store as coreStore } from '@wordpress/core-data'; import { __experimentalInspectorPopoverHeader as InspectorPopoverHeader } from '@wordpress/block-editor'; import { useInstanceId } from '@wordpress/compose'; +import { + drafts, + published, + scheduled, + pending, + notAllowed, +} from '@wordpress/icons'; /** * Internal dependencies @@ -31,13 +38,13 @@ import PostSticky from '../post-sticky'; import { PrivatePostSchedule } from '../post-schedule'; import { store as editorStore } from '../../store'; -const labels = { - 'auto-draft': __( 'Draft' ), - draft: __( 'Draft' ), - pending: __( 'Pending' ), - private: __( 'Private' ), - future: __( 'Scheduled' ), - publish: __( 'Published' ), +const postStatusesInfo = { + 'auto-draft': { label: __( 'Draft' ), icon: drafts }, + draft: { label: __( 'Draft' ), icon: drafts }, + pending: { label: __( 'Pending' ), icon: pending }, + private: { label: __( 'Private' ), icon: notAllowed }, + future: { label: __( 'Scheduled' ), icon: scheduled }, + publish: { label: __( 'Published' ), icon: published }, }; export const STATUS_OPTIONS = [ @@ -200,13 +207,14 @@ export default function PostStatus() { variant="tertiary" size="compact" onClick={ onToggle } + icon={ postStatusesInfo[ status ]?.icon } aria-label={ sprintf( // translators: %s: Current post status. __( 'Change post status: %s' ), - labels[ status ] + postStatusesInfo[ status ]?.label ) } > - { labels[ status ] } + { postStatusesInfo[ status ]?.label } ) } renderContent={ ( { onClose } ) => ( @@ -290,7 +298,7 @@ export default function PostStatus() { /> ) : (
- { labels[ status ] } + { postStatusesInfo[ status ]?.label }
) }