Skip to content

Commit

Permalink
Add margin-bottom lint rules for RangeControl (#63821)
Browse files Browse the repository at this point in the history
* Add margin-bottom lint rules for RangeControl

* Update docs

Co-authored-by: mirka <0mirka00@git.wordpress.org>
Co-authored-by: ciampo <mciampini@git.wordpress.org>
Co-authored-by: tyxla <tyxla@git.wordpress.org>
  • Loading branch information
4 people authored Jul 23, 2024
1 parent 4cf4ec3 commit 626816a
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ module.exports = {
'CheckboxControl',
'ComboboxControl',
'FocalPointPicker',
'RangeControl',
'SearchControl',
'TextareaControl',
'TreeSelect',
Expand Down
2 changes: 2 additions & 0 deletions packages/block-editor/src/layouts/grid.js
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,7 @@ function GridLayoutMinimumWidthControl( { layout, onChange } ) {
</FlexItem>
<FlexItem isBlock>
<RangeControl
__nextHasNoMarginBottom
onChange={ handleSliderChange }
value={ quantity || 0 }
min={ 0 }
Expand Down Expand Up @@ -367,6 +368,7 @@ function GridLayoutColumnsAndRowsControl( {
/>
) : (
<RangeControl
__nextHasNoMarginBottom
value={ columnCount ?? 0 }
onChange={ ( value ) =>
onChange( {
Expand Down
1 change: 1 addition & 0 deletions packages/block-library/src/post-excerpt/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export default function PostExcerptEditor( {
}
/>
<RangeControl
__nextHasNoMarginBottom
label={ __( 'Max number of words' ) }
value={ excerptLength }
onChange={ ( value ) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export default function QueryPaginationNumbersEdit( {
<InspectorControls>
<PanelBody title={ __( 'Settings' ) }>
<RangeControl
__nextHasNoMarginBottom
label={ __( 'Number of links' ) }
help={ __(
'Specify how many links can appear before and after the current page number. Links to the first, current and last page are always visible.'
Expand Down
8 changes: 8 additions & 0 deletions packages/components/src/range-control/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ const MyRangeControl = () => {

return(
<RangeControl
__nextHasNoMarginBottom
label="Columns"
value={ columns }
onChange={ ( value ) => setColumns( value ) }
Expand Down Expand Up @@ -361,6 +362,13 @@ Determines if the `input` number field will render next to the RangeControl. Thi
- Required: No
- Platform: Web

### `__nextHasNoMarginBottom`: `boolean`

Start opting into the new margin-free styles that will become the default in a future version.

- Required: No
- Default: `false`

## Related components

- To collect a numerical input in a text field, use the `TextControl` component.
1 change: 1 addition & 0 deletions packages/components/src/range-control/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,7 @@ function UnforwardedRangeControl(
* const [ isChecked, setChecked ] = useState( true );
* return (
* <RangeControl
* __nextHasNoMarginBottom
* help="Please select how transparent you would like this."
* initialPosition={50}
* label="Opacity"
Expand Down

0 comments on commit 626816a

Please sign in to comment.