Repository navigation
Add margin-bottom lint rules for TextControl #64212
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -6,6 +6,7 @@ import type { Dispatch, SetStateAction } from 'react'; | |||||
| /** | ||||||
| * WordPress dependencies | ||||||
| */ | ||||||
| import { __experimentalVStack as VStack } from '@wordpress/components'; | ||||||
| import { useMemo } from '@wordpress/element'; | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -37,14 +38,18 @@ export default function DataForm< Item >( { | |||||
| [ fields, form.visibleFields ] | ||||||
| ); | ||||||
|
|
||||||
| return visibleFields.map( ( field ) => { | ||||||
| return ( | ||||||
| <field.Edit | ||||||
| key={ field.id } | ||||||
| data={ data } | ||||||
| field={ field } | ||||||
| onChange={ onChange } | ||||||
| /> | ||||||
| ); | ||||||
| } ); | ||||||
| return ( | ||||||
| <VStack spacing={ 4 }> | ||||||
| { visibleFields.map( ( field ) => { | ||||||
| return ( | ||||||
| <field.Edit | ||||||
| key={ field.id } | ||||||
| data={ data } | ||||||
| field={ field } | ||||||
| onChange={ onChange } | ||||||
| /> | ||||||
| ); | ||||||
| } ) } | ||||||
| </VStack> | ||||||
|
Comment on lines
+41
to
+53
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Testing instructionsIn Gutenberg experiments (wp-admin/admin.php?page=gutenberg-experiments), enable the "Quick Edit in DataViews" experiment. In the Site Editor, go to Pages ( Select a page row. Click the "Show quick edit sidebar" button.
These changes can also be seen in the Storybook for |
||||||
| ); | ||||||
| } | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -76,6 +76,8 @@ function Edit< Item >( { | |
| value={ value } | ||
| options={ elements } | ||
| onChange={ onChangeControl } | ||
| __next40pxDefaultSize | ||
| __nextHasNoMarginBottom | ||
|
Comment on lines
+79
to
+80
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the SelectControl in the Data Views Quick Edit. |
||
| /> | ||
| ); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -54,6 +54,7 @@ function Edit< Item >( { | |
| value={ value ?? '' } | ||
| onChange={ onChangeControl } | ||
| __next40pxDefaultSize | ||
| __nextHasNoMarginBottom | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the TextControl in the Data Views Quick Edit. |
||
| /> | ||
| ); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -95,9 +95,10 @@ export default function AddNewPostModal( { postType, onSave, onClose } ) { | |||||
| size="small" | ||||||
| > | ||||||
| <form onSubmit={ createPost }> | ||||||
| <VStack spacing={ 3 }> | ||||||
| <VStack spacing={ 4 }> | ||||||
| <TextControl | ||||||
| __next40pxDefaultSize | ||||||
| __nextHasNoMarginBottom | ||||||
|
Comment on lines
+98
to
+101
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Testing instructionsGo to the Pages view in Site Editor (
@WordPress/gutenberg-design I'm seeing some inconsistency in the spacing before the CTA button in contexts like this. The Figma specs it as 24px — should I follow that everywhere? Also, would the spacing be different in a non-Modal context like Data Views Quick Edit, or a small block toolbar popover like the Language formatter?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @jameskoster @mattrwalker this would be a great opportunity to fix up the modal component, bring it in sync. What's the right value?
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think there could be a case for a dedicated
But that's probably part of a much broader update to
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, if we don't have spec'ed values yet, I'm going to go with the path of least resistance as long as it's in the general vicinity of what's correct. In a lot of cases, that's going to be a space equidistant between all the control gaps (i.e. throw them all in a single |
||||||
| label={ __( 'Title' ) } | ||||||
| onChange={ setTitle } | ||||||
| placeholder={ __( 'No title' ) } | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -10,7 +10,11 @@ import { __ } from '@wordpress/i18n'; | |
| import { DataForm, isItemValid } from '@wordpress/dataviews'; | ||
| import { useDispatch, useSelect, useRegistry } from '@wordpress/data'; | ||
| import { store as coreDataStore } from '@wordpress/core-data'; | ||
| import { Button } from '@wordpress/components'; | ||
| import { | ||
| Button, | ||
| FlexItem, | ||
| __experimentalVStack as VStack, | ||
| } from '@wordpress/components'; | ||
| import { useState, useMemo } from '@wordpress/element'; | ||
|
|
||
| /** | ||
|
|
@@ -71,22 +75,25 @@ function PostEditForm( { postType, postId } ) { | |
|
|
||
| const isUpdateDisabled = ! isItemValid( itemWithEdits, fields, form ); | ||
| return ( | ||
| <form onSubmit={ onSubmit }> | ||
| <VStack as="form" onSubmit={ onSubmit } spacing={ 4 }> | ||
| <DataForm | ||
| data={ itemWithEdits } | ||
| fields={ fields } | ||
| form={ form } | ||
| onChange={ setEdits } | ||
| /> | ||
| <Button | ||
| variant="primary" | ||
| type="submit" | ||
| accessibleWhenDisabled | ||
| disabled={ isUpdateDisabled } | ||
| > | ||
| { __( 'Update' ) } | ||
| </Button> | ||
| </form> | ||
| <FlexItem> | ||
| <Button | ||
| variant="primary" | ||
| type="submit" | ||
| accessibleWhenDisabled | ||
| disabled={ isUpdateDisabled } | ||
| __next40pxDefaultSize | ||
| > | ||
| { __( 'Update' ) } | ||
| </Button> | ||
| </FlexItem> | ||
| </VStack> | ||
|
Comment on lines
+78
to
+96
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the |
||
| ); | ||
| } | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import { | |
| Button, | ||
| Popover, | ||
| __experimentalHStack as HStack, | ||
| __experimentalVStack as VStack, | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| } from '@wordpress/components'; | ||
| import { useState } from '@wordpress/element'; | ||
| import { applyFormat, removeFormat, useAnchor } from '@wordpress/rich-text'; | ||
|
|
@@ -78,7 +79,9 @@ function InlineLanguageUI( { value, contentRef, onChange, onClose } ) { | |
| anchor={ popoverAnchor } | ||
| onClose={ onClose } | ||
| > | ||
| <form | ||
| <VStack | ||
| as="form" | ||
| spacing={ 4 } | ||
| className="block-editor-format-toolbar__language-container-content" | ||
| onSubmit={ ( event ) => { | ||
| event.preventDefault(); | ||
|
|
@@ -95,6 +98,8 @@ function InlineLanguageUI( { value, contentRef, onChange, onClose } ) { | |
| } } | ||
| > | ||
| <TextControl | ||
| __next40pxDefaultSize | ||
| __nextHasNoMarginBottom | ||
| label={ title } | ||
| value={ lang } | ||
| onChange={ ( val ) => setLang( val ) } | ||
|
|
@@ -103,6 +108,8 @@ function InlineLanguageUI( { value, contentRef, onChange, onClose } ) { | |
| ) } | ||
| /> | ||
| <SelectControl | ||
| __next40pxDefaultSize | ||
| __nextHasNoMarginBottom | ||
| label={ __( 'Text direction' ) } | ||
| value={ dir } | ||
| options={ [ | ||
|
|
@@ -119,12 +126,13 @@ function InlineLanguageUI( { value, contentRef, onChange, onClose } ) { | |
| /> | ||
| <HStack alignment="right"> | ||
| <Button | ||
| __next40pxDefaultSize | ||
| variant="primary" | ||
| type="submit" | ||
| text={ __( 'Apply' ) } | ||
| /> | ||
| </HStack> | ||
| </form> | ||
| </VStack> | ||
| </Popover> | ||
| ); | ||
| } | ||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Testing instructions
In Gutenberg experiments (
wp-admin/admin.php?page=gutenberg-experiments), enable the "Form and input blocks" experiment. In the editor, add a Form block. In the block inspector, expand the "Advanced" section at the bottom.