-
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
UnitControl: Add lint rule for 40px size prop usage #64520
Changes from all commits
2a5dfb9
eb0aca1
8b5f9c5
dd023d7
e72bbf3
20d4901
2b3e3a1
7aabc76
71fbd47
f89194d
3108cbc
cce17eb
7bb9fe1
6d10c8e
d883d00
f30e6ce
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 |
---|---|---|
|
@@ -38,13 +38,20 @@ The current value of the letter spacing setting. | |
|
||
A callback function invoked when the value is changed. | ||
|
||
### `_unstableInputWidth` | ||
### `__unstableInputWidth` | ||
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. Fixed typo |
||
|
||
- **Type:** `string|number|undefined` | ||
- **Default:** `undefined` | ||
|
||
Input width to pass through to inner UnitControl. Should be a valid CSS value. | ||
|
||
#### `__next40pxDefaultSize` | ||
|
||
- **Type:** `boolean` | ||
- **Default:** `false` | ||
|
||
Start opting into the larger default height that will become the default size in a future version. | ||
|
||
## Related components | ||
|
||
Block Editor components are components that can be used to compose the UI of your block editor. Thus, they can only be used under a [`BlockEditorProvider`](https://github.com/WordPress/gutenberg/blob/HEAD/packages/block-editor/src/components/provider/README.md) in the components tree. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,14 +15,16 @@ import { useSettings } from '../../components/use-settings'; | |
/** | ||
* Control for letter-spacing. | ||
* | ||
* @param {Object} props Component props. | ||
* @param {string} props.value Currently selected letter-spacing. | ||
* @param {Function} props.onChange Handles change in letter-spacing selection. | ||
* @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value. | ||
* @param {Object} props Component props. | ||
* @param {boolean} props.__next40pxDefaultSize Start opting into the larger default height that will become the default size in a future version. | ||
* @param {string} props.value Currently selected letter-spacing. | ||
* @param {Function} props.onChange Handles change in letter-spacing selection. | ||
* @param {string|number|undefined} props.__unstableInputWidth Input width to pass through to inner UnitControl. Should be a valid CSS value. | ||
* | ||
* @return {Element} Letter-spacing control. | ||
*/ | ||
export default function LetterSpacingControl( { | ||
__next40pxDefaultSize = false, | ||
value, | ||
onChange, | ||
__unstableInputWidth = '60px', | ||
|
@@ -35,6 +37,7 @@ export default function LetterSpacingControl( { | |
} ); | ||
return ( | ||
<UnitControl | ||
__next40pxDefaultSize={ __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. This was already passed through via |
||
{ ...otherProps } | ||
label={ __( 'Letter spacing' ) } | ||
value={ value } | ||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -73,13 +73,13 @@ function CoverHeightInput( { | |||||
|
||||||
return ( | ||||||
<UnitControl | ||||||
label={ __( 'Minimum height of cover' ) } | ||||||
__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.
Tweaked as discussed in #64520 (comment) |
||||||
label={ __( 'Minimum height' ) } | ||||||
id={ inputId } | ||||||
isResetValueOnUnitChange | ||||||
min={ min } | ||||||
onChange={ handleOnChange } | ||||||
onUnitChange={ onUnitChange } | ||||||
__unstableInputWidth="80px" | ||||||
units={ units } | ||||||
value={ computedValue } | ||||||
/> | ||||||
|
@@ -299,6 +299,7 @@ export default function CoverInspectorControls( { | |||||
) } | ||||||
<InspectorControls group="dimensions"> | ||||||
<ToolsPanelItem | ||||||
className="single-column" | ||||||
hasValue={ () => !! minHeight } | ||||||
label={ __( 'Minimum height' ) } | ||||||
onDeselect={ () => | ||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -134,8 +134,7 @@ const DimensionControls = ( { | |||||
panelId={ clientId } | ||||||
> | ||||||
<SelectControl | ||||||
// TODO: Switch to `true` (40px size) if possible | ||||||
__next40pxDefaultSize={ false } | ||||||
__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.
Incorrect column gap will be addressed separately at #64488 |
||||||
__nextHasNoMarginBottom | ||||||
label={ __( 'Aspect ratio' ) } | ||||||
value={ aspectRatio } | ||||||
|
@@ -157,6 +156,7 @@ const DimensionControls = ( { | |||||
panelId={ clientId } | ||||||
> | ||||||
<UnitControl | ||||||
__next40pxDefaultSize | ||||||
label={ __( 'Height' ) } | ||||||
labelPosition="top" | ||||||
value={ height || '' } | ||||||
|
@@ -179,6 +179,7 @@ const DimensionControls = ( { | |||||
panelId={ clientId } | ||||||
> | ||||||
<UnitControl | ||||||
__next40pxDefaultSize | ||||||
label={ __( 'Width' ) } | ||||||
labelPosition="top" | ||||||
value={ width || '' } | ||||||
|
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.