diff --git a/packages/editor/src/components/post-publish-panel/maybe-post-format-panel.js b/packages/editor/src/components/post-publish-panel/maybe-post-format-panel.js new file mode 100644 index 00000000000000..8267a8a79b407d --- /dev/null +++ b/packages/editor/src/components/post-publish-panel/maybe-post-format-panel.js @@ -0,0 +1,33 @@ +/** + * WordPress dependencies. + */ +import { __ } from '@wordpress/i18n'; +import { withSelect } from '@wordpress/data'; +import { Dashicon, PanelBody } from '@wordpress/components'; + +/** + * Internal dependencies. + */ +import PostFormat from '../post-format'; + +const MaybePostFormatPanel = ( { currentPostFormat, suggestedPostFormat } ) => suggestedPostFormat && + suggestedPostFormat !== currentPostFormat && + , + __( 'Tip:' ), + { + __( 'Choose a fitting post format' ) + }, + ] } > + + ; + +export default withSelect( + ( select ) => { + const { getEditedPostAttribute, getSuggestedPostFormat } = select( 'core/editor' ); + return { + suggestedPostFormat: getSuggestedPostFormat(), + currentPostFormat: getEditedPostAttribute( 'format' ), + }; + } +)( MaybePostFormatPanel ); diff --git a/packages/editor/src/components/post-publish-panel/prepublish.js b/packages/editor/src/components/post-publish-panel/prepublish.js index 59f99679fe3ae7..36c1669170ee0f 100644 --- a/packages/editor/src/components/post-publish-panel/prepublish.js +++ b/packages/editor/src/components/post-publish-panel/prepublish.js @@ -19,6 +19,7 @@ import PostVisibilityLabel from '../post-visibility/label'; import PostSchedule from '../post-schedule'; import PostScheduleLabel from '../post-schedule/label'; import MaybeTagsPanel from './maybe-tags-panel'; +import MaybePostFormatPanel from './maybe-post-format-panel'; function PostPublishPanelPrepublish( { hasPublishAction, @@ -42,6 +43,7 @@ function PostPublishPanelPrepublish( { ] }> + { children }