Skip to content

Commit

Permalink
Add clearer labels and context to BlockPatternsSyncFilter (#54838)
Browse files Browse the repository at this point in the history
* Add help text & clearer labeling

* Theme & Plugins
  • Loading branch information
richtabor authored and mikachan committed Oct 4, 2023
1 parent 6256f93 commit 05755f3
Showing 1 changed file with 22 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import {
DropdownMenu,
MenuGroup,
MenuItemsChoice,
ExternalLink,
} from '@wordpress/components';
import { __ } from '@wordpress/i18n';
import { Icon } from '@wordpress/icons';
import { useMemo } from '@wordpress/element';
import { useMemo, createInterpolateElement } from '@wordpress/element';

/**
* Internal dependencies
Expand Down Expand Up @@ -73,13 +74,11 @@ export function BlockPatternsSyncFilter( {
{
value: SYNC_TYPES.full,
label: __( 'Synced' ),
info: __( 'Updated everywhere' ),
disabled: shouldDisableSyncFilter,
},
{
value: SYNC_TYPES.unsynced,
label: __( 'Standard' ),
info: __( 'Edit freely' ),
label: __( 'Not synced' ),
disabled: shouldDisableSyncFilter,
},
],
Expand All @@ -95,20 +94,17 @@ export function BlockPatternsSyncFilter( {
},
{
value: PATTERN_TYPES.directory,
label: __( 'Directory' ),
info: __( 'Pattern directory & core' ),
label: __( 'Pattern Directory' ),
disabled: shouldDisableNonUserSources,
},
{
value: PATTERN_TYPES.theme,
label: __( 'Theme' ),
info: __( 'Bundled with the theme' ),
label: __( 'Theme & Plugins' ),
disabled: shouldDisableNonUserSources,
},
{
value: PATTERN_TYPES.user,
label: __( 'User' ),
info: __( 'Custom created' ),
},
],
[ shouldDisableNonUserSources ]
Expand Down Expand Up @@ -149,7 +145,7 @@ export function BlockPatternsSyncFilter( {
>
{ () => (
<>
<MenuGroup label={ __( 'Author' ) }>
<MenuGroup label={ __( 'Source' ) }>
<MenuItemsChoice
choices={ patternSourceMenuOptions }
onSelect={ ( value ) => {
Expand All @@ -175,6 +171,22 @@ export function BlockPatternsSyncFilter( {
value={ patternSyncFilter }
/>
</MenuGroup>
<div className="block-editor-tool-selector__help">
{ createInterpolateElement(
__(
'Patterns are available from the <Link>WordPress.org Pattern Directory</Link>, bundled in the active theme, or created by users on this site. Only patterns created on this site can be synced.'
),
{
Link: (
<ExternalLink
href={ __(
'https://wordpress.org/patterns/'
) }
/>
),
}
) }
</div>
</>
) }
</DropdownMenu>
Expand Down

0 comments on commit 05755f3

Please sign in to comment.