Skip to content

Commit

Permalink
Apply __next40pxDefaultSize to TextControl and Button component in re…
Browse files Browse the repository at this point in the history
…naming UIs (#56933)

* Apply __next40pxDefaultSize to TextControl in renaming UIs

* Apply __next40pxDefaultSize to Button in renaming UIs
  • Loading branch information
t-hamano committed Dec 11, 2023
1 parent 7358f66 commit 70bc49f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 7 deletions.
8 changes: 7 additions & 1 deletion packages/block-editor/src/components/block-rename/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default function BlockRenameModal( {
<VStack spacing="3">
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ editedBlockName }
label={ __( 'Block name' ) }
hideLabelFromVision={ true }
Expand All @@ -96,11 +97,16 @@ export default function BlockRenameModal( {
onFocus={ autoSelectInputText }
/>
<HStack justify="right">
<Button variant="tertiary" onClick={ onClose }>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ onClose }
>
{ __( 'Cancel' ) }
</Button>

<Button
__next40pxDefaultSize
aria-disabled={ ! isNameValid }
variant="primary"
type="submit"
Expand Down
1 change: 1 addition & 0 deletions packages/block-editor/src/hooks/block-renaming.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ function BlockRenameControlPure( { metadata, setAttributes } ) {
<InspectorControls group="advanced">
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
label={ __( 'Block name' ) }
value={ metadata?.name || '' }
onChange={ ( newName ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export default function RenameMenuItem( { item, onClose } ) {
<VStack spacing="5">
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
label={ __( 'Name' ) }
value={ title }
onChange={ setTitle }
Expand All @@ -104,6 +105,7 @@ export default function RenameMenuItem( { item, onClose } ) {

<HStack justify="right">
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ () => {
setIsModalOpen( false );
Expand All @@ -113,7 +115,11 @@ export default function RenameMenuItem( { item, onClose } ) {
{ __( 'Cancel' ) }
</Button>

<Button variant="primary" type="submit">
<Button
__next40pxDefaultSize
variant="primary"
type="submit"
>
{ __( 'Save' ) }
</Button>
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,16 +27,22 @@ export default function RenameModal( { menuTitle, onClose, onSave } ) {
<VStack spacing="3">
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
value={ editedMenuTitle }
placeholder={ __( 'Navigation title' ) }
onChange={ setEditedMenuTitle }
/>
<HStack justify="right">
<Button variant="tertiary" onClick={ onClose }>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ onClose }
>
{ __( 'Cancel' ) }
</Button>

<Button
__next40pxDefaultSize
disabled={ ! isEditedMenuTitleValid }
variant="primary"
type="submit"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export default function RenameMenuItem( { template, onClose } ) {
<VStack spacing="5">
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
label={ __( 'Name' ) }
value={ editedTitle }
onChange={ setEditedTitle }
Expand All @@ -115,6 +116,7 @@ export default function RenameMenuItem( { template, onClose } ) {

<HStack justify="right">
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ () => {
setIsModalOpen( false );
Expand All @@ -123,7 +125,11 @@ export default function RenameMenuItem( { template, onClose } ) {
{ __( 'Cancel' ) }
</Button>

<Button variant="primary" type="submit">
<Button
__next40pxDefaultSize
variant="primary"
type="submit"
>
{ __( 'Save' ) }
</Button>
</HStack>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ export default function RenamePatternCategoryModal( {
<TextControl
ref={ textControlRef }
__nextHasNoMarginBottom
__next40pxDefaultSize
label={ __( 'Name' ) }
value={ name }
onChange={ onChange }
Expand All @@ -154,10 +155,15 @@ export default function RenamePatternCategoryModal( {
) }
</VStack>
<HStack justify="right">
<Button variant="tertiary" onClick={ onRequestClose }>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ onRequestClose }
>
{ __( 'Cancel' ) }
</Button>
<Button
__next40pxDefaultSize
variant="primary"
type="submit"
aria-disabled={
Expand Down
13 changes: 11 additions & 2 deletions packages/patterns/src/components/rename-pattern-modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -93,18 +93,27 @@ export default function RenamePatternModal( {
<VStack spacing="5">
<TextControl
__nextHasNoMarginBottom
__next40pxDefaultSize
label={ __( 'Name' ) }
value={ name }
onChange={ setName }
required
/>

<HStack justify="right">
<Button variant="tertiary" onClick={ onRequestClose }>
<Button
__next40pxDefaultSize
variant="tertiary"
onClick={ onRequestClose }
>
{ __( 'Cancel' ) }
</Button>

<Button variant="primary" type="submit">
<Button
__next40pxDefaultSize
variant="primary"
type="submit"
>
{ __( 'Save' ) }
</Button>
</HStack>
Expand Down

1 comment on commit 70bc49f

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Flaky tests detected in 70bc49f.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.

🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/7165982784
📝 Reported issues:

Please sign in to comment.