-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
35 additions
and
0 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
packages/editor/src/components/post-publish-panel/maybe-post-format-panel.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 && | ||
<PanelBody initialOpen={ true } title={ [ | ||
<Dashicon key={ 'dashicon-lightbulb' } icon={ 'lightbulb' } />, | ||
__( 'Tip:' ), | ||
<span className="editor-post-publish-panel__link" key="label">{ | ||
__( 'Choose a fitting post format' ) | ||
}</span>, | ||
] } > | ||
<PostFormat /> | ||
</PanelBody>; | ||
|
||
export default withSelect( | ||
( select ) => { | ||
const { getEditedPostAttribute, getSuggestedPostFormat } = select( 'core/editor' ); | ||
return { | ||
suggestedPostFormat: getSuggestedPostFormat(), | ||
currentPostFormat: getEditedPostAttribute( 'format' ), | ||
}; | ||
} | ||
)( MaybePostFormatPanel ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters