Skip to content

Commit

Permalink
Add validation to form button, improve spacing.
Browse files Browse the repository at this point in the history
  • Loading branch information
jffng committed Mar 29, 2023
1 parent b5c6a17 commit 6efb440
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { __ } from '@wordpress/i18n';
import {
Button,
__experimentalVStack as VStack,
__experimentalSpacer as Spacer,
__experimentalText as Text,
__experimentalHeading as Heading,
PanelBody,
Expand Down Expand Up @@ -75,6 +76,7 @@ const ExportTheme = () => {
'create-block-theme'
) }
</Text>
<Spacer/>
<TextControl
label={ __( 'Theme name', 'create-block-theme' ) }
value={ theme.name }
Expand Down Expand Up @@ -128,9 +130,12 @@ const ExportTheme = () => {
) }
/>
</VStack>
<Button variant="secondary" onClick={ handleSubmit }>
<Spacer/>
<Button variant="secondary" disabled={ ! theme.name } onClick={ handleSubmit }>
{ __( 'Export', 'create-block-theme' ) }
</Button>
<Spacer/>
{ ! theme.name && (<Text variant="muted">{ __( 'Theme name is required for export.', 'create-block-theme' ) }</Text>)}
</PanelBody>
);
};
Expand Down

0 comments on commit 6efb440

Please sign in to comment.