-
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
RangeControl: Add lint rule for 40px size prop usage #64558
Changes from 9 commits
490c6d0
9d4312a
9618fef
47f5cc8
71db8f1
55c38a1
f423047
982aab5
d46937c
7f28701
43337a5
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 |
---|---|---|
|
@@ -164,6 +164,7 @@ export default function HeightControl( { | |
<FlexItem isBlock> | ||
<Spacer marginX={ 2 } marginBottom={ 0 }> | ||
<RangeControl | ||
__next40pxDefaultSize | ||
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. |
||
value={ customRangeValue } | ||
min={ 0 } | ||
max={ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { ToolbarButton, RangeControl, Dropdown } from '@wordpress/components'; | ||
import { | ||
ToolbarButton, | ||
RangeControl, | ||
Dropdown, | ||
__experimentalDropdownContentWrapper as DropdownContentWrapper, | ||
} from '@wordpress/components'; | ||
import { __ } from '@wordpress/i18n'; | ||
import { search } from '@wordpress/icons'; | ||
|
||
|
@@ -27,14 +32,17 @@ export default function ZoomDropdown() { | |
/> | ||
) } | ||
renderContent={ () => ( | ||
<RangeControl | ||
__nextHasNoMarginBottom | ||
label={ __( 'Zoom' ) } | ||
min={ MIN_ZOOM } | ||
max={ MAX_ZOOM } | ||
value={ Math.round( zoom ) } | ||
onChange={ setZoom } | ||
/> | ||
<DropdownContentWrapper paddingSize="medium"> | ||
<RangeControl | ||
__next40pxDefaultSize | ||
__nextHasNoMarginBottom | ||
label={ __( 'Zoom' ) } | ||
min={ MIN_ZOOM } | ||
max={ MAX_ZOOM } | ||
value={ Math.round( zoom ) } | ||
onChange={ setZoom } | ||
/> | ||
</DropdownContentWrapper> | ||
Comment on lines
+35
to
+45
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. |
||
) } | ||
/> | ||
); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -249,6 +249,7 @@ export default function SpacingInputControl( { | |
} } | ||
/> | ||
<RangeControl | ||
__next40pxDefaultSize | ||
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. |
||
onMouseOver={ onMouseOver } | ||
onMouseOut={ onMouseOut } | ||
onFocus={ onMouseOver } | ||
|
@@ -270,6 +271,7 @@ export default function SpacingInputControl( { | |
) } | ||
{ showRangeControl && ! showCustomValueControl && ( | ||
<RangeControl | ||
__next40pxDefaultSize | ||
onMouseOver={ onMouseOver } | ||
onMouseOut={ onMouseOut } | ||
className="spacing-sizes-control__range-control" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,17 +18,7 @@ | |
|
||
.spacing-sizes-control__range-control, | ||
.spacing-sizes-control__custom-value-range { | ||
height: 40px; | ||
/* Vertically center the RangeControl until it has true 40px height. */ | ||
display: flex; | ||
align-items: center; | ||
margin-bottom: 0; | ||
Comment on lines
-21
to
-25
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. Love it that we can clean up all those styles 🚀 |
||
flex: 1; | ||
|
||
> .components-base-control__field { | ||
/* Fixes RangeControl contents when the outer wrapper is flex */ | ||
flex: 1; | ||
} | ||
} | ||
|
||
.components-range-control__mark { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -264,6 +264,7 @@ function GridLayoutMinimumWidthControl( { layout, onChange } ) { | |
</FlexItem> | ||
<FlexItem isBlock> | ||
<RangeControl | ||
__next40pxDefaultSize | ||
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. |
||
__nextHasNoMarginBottom | ||
onChange={ handleSliderChange } | ||
value={ quantity || 0 } | ||
|
@@ -368,6 +369,7 @@ function GridLayoutColumnsAndRowsControl( { | |
/> | ||
) : ( | ||
<RangeControl | ||
__next40pxDefaultSize | ||
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. |
||
__nextHasNoMarginBottom | ||
value={ columnCount ?? 0 } | ||
onChange={ ( value ) => | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -231,6 +231,7 @@ export default function PostExcerptEditor( { | |
} | ||
/> | ||
<RangeControl | ||
__next40pxDefaultSize | ||
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. |
||
__nextHasNoMarginBottom | ||
label={ __( 'Max number of words' ) } | ||
value={ excerptLength } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -51,6 +51,7 @@ export default function QueryPaginationNumbersEdit( { | |
<InspectorControls> | ||
<PanelBody title={ __( 'Settings' ) }> | ||
<RangeControl | ||
__next40pxDefaultSize | ||
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. |
||
__nextHasNoMarginBottom | ||
label={ __( 'Number of links' ) } | ||
help={ __( | ||
|
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.
Can be seen in the block inspector ▸ Styles ▸ Border & Shadow of an Image block. No visual change because this is a standalone slider-only RangeControl instance.