Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve tags UI #630

Merged
merged 4 commits into from
May 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 22 additions & 8 deletions src/editor-sidebar/metadata-editor-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
// eslint-disable-next-line
__experimentalText as Text,
BaseControl,
FormTokenField,
Modal,
Button,
TextControl,
Expand Down Expand Up @@ -97,6 +98,10 @@ export const ThemeMetadataEditorModal = ( { onRequestClose } ) => {
} );
};

const onChangeTags = ( newTags ) => {
setTheme( { ...theme, tags_custom: newTags.join( ', ' ) } );
};

const onUpdateImage = ( image ) => {
setTheme( { ...theme, screenshot: image.url } );
};
Expand Down Expand Up @@ -179,17 +184,26 @@ export const ThemeMetadataEditorModal = ( { onRequestClose } ) => {
'create-block-theme'
) }
/>
<TextareaControl
<FormTokenField
label={ __( 'Theme tags', 'create-block-theme' ) }
value={ theme.tags_custom }
onChange={ ( value ) =>
setTheme( { ...theme, tags_custom: value } )
value={
theme.tags_custom ? theme.tags_custom.split( ', ' ) : []
}
placeholder={ __(
'A comma-separated collection of tags',
'create-block-theme'
) }
onChange={ onChangeTags }
/>
vcanales marked this conversation as resolved.
Show resolved Hide resolved
<HStack
style={ {
marginTop: '-20px',
marginBottom: '1rem',
} }
>
<ExternalLink
href="https://make.wordpress.org/themes/handbook/review/required/theme-tags/"
style={ { fontSize: '12px' } }
>
{ __( 'Read more.', 'create-block-theme' ) }
</ExternalLink>
</HStack>
<TextareaControl
label={ __( 'Recommended Plugins', 'create-block-theme' ) }
help={
Expand Down
Loading