-
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
SelectControl: Add lint rule for 40px size prop usage #64486
Changes from 2 commits
14b4ff5
75a7309
d3e8ce4
ed4a396
7d23ed2
777aeba
892c9c1
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 |
---|---|---|
|
@@ -11,6 +11,8 @@ import { __ } from '@wordpress/i18n'; | |
import { useSettings } from '../use-settings'; | ||
|
||
export default function FontFamilyControl( { | ||
/** Start opting into the larger default height that will become the default size in a future version. */ | ||
__next40pxDefaultSize = false, | ||
/** Start opting into the new margin-free styles that will become the default in a future version. */ | ||
__nextHasNoMarginBottom = false, | ||
value = '', | ||
|
@@ -50,6 +52,7 @@ export default function FontFamilyControl( { | |
|
||
return ( | ||
<SelectControl | ||
__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 rest props, but making it explicit here. |
||
__nextHasNoMarginBottom={ __nextHasNoMarginBottom } | ||
label={ __( 'Font' ) } | ||
options={ options } | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -40,6 +40,7 @@ const renderTestDefaultControlComponent = ( labelComponent, device ) => { | |
return ( | ||
<> | ||
<SelectControl | ||
__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. Doesn't matter because this is a test. |
||
label={ labelComponent } | ||
options={ sizeOptions } | ||
__nextHasNoMarginBottom | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -174,6 +174,8 @@ function AudioEdit( { | |
checked={ loop } | ||
/> | ||
<SelectControl | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
__nextHasNoMarginBottom | ||
label={ _x( 'Preload', 'noun; Audio block parameter' ) } | ||
value={ preload || '' } | ||
|
@@ -197,10 +199,10 @@ function AudioEdit( { | |
</InspectorControls> | ||
<figure { ...blockProps }> | ||
{ /* | ||
Disable the audio tag if the block is not selected | ||
so the user clicking on it won't play the | ||
file or change the position slider when the controls are enabled. | ||
*/ } | ||
Disable the audio tag if the block is not selected | ||
so the user clicking on it won't play the | ||
file or change the position slider when the controls are enabled. | ||
*/ } | ||
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. is this mix of spaces and tabs in the file expected? 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. Weird, I reformatted it and it changed the spaces back to tabs, but it still doesn't match the original. Not sure why it isn't deterministic 🤷 892c9c1 |
||
<Disabled isDisabled={ ! isSingleSelected }> | ||
<audio controls="controls" src={ src ?? temporaryURL } /> | ||
</Disabled> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -130,6 +130,8 @@ const Edit = ( { attributes, setAttributes, clientId } ) => { | |
{ submissionMethod !== 'email' && ( | ||
<InspectorControls group="advanced"> | ||
<SelectControl | ||
// TODO: Switch to `true` (40px size) if possible | ||
__next40pxDefaultSize={ false } | ||
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. (excuses if this has already been asked) Do we have a place where we track all the occurrences that need updating and are exception to the lint rule? 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'm assuming you're asking about discoverability. A few ways:
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. Makes sense, thank you! |
||
__nextHasNoMarginBottom | ||
label={ __( 'Method' ) } | ||
options={ [ | ||
|
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.
By the way this prop is not yet documented in any of the
@wordpress/components
READMEs at the moment, just in Storybook. I'll do a PR soon to add them all.