Skip to content

Commit

Permalink
Always show description in Post Format panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
ZebulanStanphill committed Sep 8, 2020
1 parent 5dc79c9 commit 61d9e98
Showing 1 changed file with 11 additions and 20 deletions.
31 changes: 11 additions & 20 deletions packages/editor/src/components/post-format/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@ export const POST_FORMAT_TITLES = {
video: __( 'Video' ),
};

export default function PostFormat( { showDescription = false } ) {
export default function PostFormat() {
const instanceId = useInstanceId( PostFormat );
const postFormatSelectorId = `post-format-selector-${ instanceId }`;
const formatSelectorId = `post-format-selector-${ instanceId }`;
const descriptionId = `editor-post-format__description-${ instanceId }`;

const { currentFormat, listedFormats, suggestedFormat } = useSelect(
( select ) => {
Expand Down Expand Up @@ -75,35 +76,25 @@ export default function PostFormat( { showDescription = false } ) {
<PostFormatCheck>
<div className="editor-post-format">
<div className="editor-post-format__content">
<label htmlFor={ postFormatSelectorId }>
<label htmlFor={ formatSelectorId }>
{ __( 'Post Format' ) }
</label>
<SelectControl
value={ currentFormat }
onChange={ ( format ) => updatePostFormat( format ) }
id={ postFormatSelectorId }
id={ formatSelectorId }
options={ listedFormats.map( ( format ) => ( {
label: POST_FORMAT_TITLES[ format ],
value: format,
} ) ) }
aria-describedby={
showDescription
? `editor-post-format__description-${ postFormatSelectorId }`
: undefined
}
aria-describedby={ descriptionId }
/>
</div>

{ showDescription && (
<p
id={ `editor-post-format__description-${ postFormatSelectorId }` }
>
{ __(
'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'
) }
</p>
) }

<p id={ descriptionId }>
{ __(
'Your theme uses post formats to highlight different kinds of content, like images or videos. Apply a post format to see this special styling.'
) }
</p>
{ suggestedFormat && (
<div className="editor-post-format__suggestion">
{ __( 'Suggestion:' ) }{ ' ' }
Expand Down

0 comments on commit 61d9e98

Please sign in to comment.