Skip to content

Commit

Permalink
Improve tags UI (#630)
Browse files Browse the repository at this point in the history
* Improve tags ui

* Added the styled external link

* Fix focus style

---------

Co-authored-by: Jason Crist <jcrist@pbking.com>
  • Loading branch information
t-hamano and pbking committed May 14, 2024
1 parent 7aed6ce commit cd7f1ec
Showing 1 changed file with 22 additions and 8 deletions.
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 }
/>
<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

0 comments on commit cd7f1ec

Please sign in to comment.