-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Add margin-bottom lint rules for BaseControl #64355
Changes from 3 commits
a7beddd
aa333d5
4ea9b9f
9771ed8
58d1297
78bbf67
fd1a731
85f7e92
aec5c2d
55ede85
f12b7fd
a9e31ed
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 | ||||
---|---|---|---|---|---|---|
|
@@ -28,7 +28,7 @@ import { | |||||
ToolbarButton, | ||||||
ResizableBox, | ||||||
PanelBody, | ||||||
BaseControl, | ||||||
__experimentalVStack as VStack, | ||||||
__experimentalUseCustomUnits as useCustomUnits, | ||||||
__experimentalUnitControl as UnitControl, | ||||||
} from '@wordpress/components'; | ||||||
|
@@ -408,12 +408,14 @@ export default function SearchEdit( { | |||||
|
||||||
<InspectorControls> | ||||||
<PanelBody title={ __( 'Settings' ) }> | ||||||
<BaseControl | ||||||
label={ __( 'Width' ) } | ||||||
id={ unitControlInputId } | ||||||
<VStack | ||||||
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 the editor, add a Search block and see the block inspector.
This UI probably should be updated to Spacing is the same as a similar pattern in the Latest Posts block. 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. Looks good, but it would have been suitable for another PR, perhaps with a design person taking a look 🤔 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. You may be right! This is still bad though, just incrementally better. I'm keeping an eye on #52223 to figure out what this UI should be ideally. |
||||||
className="wp-block-search__inspector-controls" | ||||||
spacing={ 4 } | ||||||
> | ||||||
<UnitControl | ||||||
id={ unitControlInputId } | ||||||
__next40pxDefaultSize | ||||||
label={ __( 'Width' ) } | ||||||
id={ unitControlInputId } // unused, kept for backwards compatibility | ||||||
min={ | ||||||
isPercentageUnit( widthUnit ) ? 0 : MIN_WIDTH | ||||||
} | ||||||
|
@@ -427,7 +429,6 @@ export default function SearchEdit( { | |||||
parseInt( newWidth, 10 ) > 100 | ||||||
? 100 | ||||||
: newWidth; | ||||||
|
||||||
setAttributes( { | ||||||
width: parseInt( filteredWidth, 10 ), | ||||||
} ); | ||||||
|
@@ -445,9 +446,8 @@ export default function SearchEdit( { | |||||
value={ `${ width }${ widthUnit }` } | ||||||
units={ units } | ||||||
/> | ||||||
|
||||||
<ButtonGroup | ||||||
className="wp-block-search__components-button-group" | ||||||
className="wp-block-search__components-button-group" // unused, kept for backwards compatibility | ||||||
aria-label={ __( 'Percentage Width' ) } | ||||||
> | ||||||
{ [ 25, 50, 75, 100 ].map( ( widthValue ) => { | ||||||
|
@@ -473,7 +473,7 @@ export default function SearchEdit( { | |||||
); | ||||||
} ) } | ||||||
</ButtonGroup> | ||||||
</BaseControl> | ||||||
</VStack> | ||||||
</PanelBody> | ||||||
</InspectorControls> | ||||||
</> | ||||||
|
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
Somewhere in this file, set the
imageSizeOptions
variable asfalse
. In the editor, add a Gallery block with an image, and see the block inspector.