Skip to content
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 ToggleGroupControl #63960

Merged
merged 4 commits into from
Jul 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -296,6 +296,7 @@ module.exports = {
'RangeControl',
'SearchControl',
'TextareaControl',
'ToggleGroupControl',
'TreeSelect',
].map( ( componentName ) => ( {
selector: `JSXOpeningElement[name.name="${ componentName }"]:not(:has(JSXAttribute[name.name="__nextHasNoMarginBottom"]))`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export default function ScaleTool( {
panelId={ panelId }
>
<ToggleGroupControl
__nextHasNoMarginBottom
label={ __( 'Scale' ) }
isBlock
help={ scaleHelp[ displayValue ] }
Expand Down
Copy link
Member Author

@mirka mirka Jul 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing instructions

Add a Group block. In the block inspector, go to the Styles tab and set a Background image. Click the ItemGroup button with your image now set, and it will show all the controls in a flyout.

Background image panel popover

Original file line number Diff line number Diff line change
Expand Up @@ -569,6 +569,7 @@ function BackgroundSizeControls( {
onChange={ updateBackgroundPosition }
/>
<ToggleControl
__nextHasNoMarginBottom
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding these to ToggleControls as well, since we're already here 😘

label={ __( 'Fixed background' ) }
checked={ attachmentValue === 'fixed' }
onChange={ toggleScrollWithPage }
Expand All @@ -577,6 +578,7 @@ function BackgroundSizeControls( {
) }
/>
<ToggleGroupControl
__nextHasNoMarginBottom
size="__unstable-large"
label={ __( 'Size' ) }
value={ currentValueForToggle }
Expand Down Expand Up @@ -626,6 +628,7 @@ function BackgroundSizeControls( {
}
/>
<ToggleControl
__nextHasNoMarginBottom
label={ __( 'Repeat' ) }
checked={ repeatCheckedValue }
onChange={ toggleIsRepeated }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,6 @@
.block-editor-global-styles-background-panel__dropdown-content-wrapper {
min-width: 260px;
overflow-x: hidden;
.components-base-control__help,
.components-toggle-control {
margin-bottom: 0;
}
Comment on lines -196 to -199
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No longer necessary.


.components-focal-point-picker-wrapper {
background-color: $gray-100;
Expand Down
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testing instructions

Add a Query Loop block and see the block inspector.

Query Loop block inspector

Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ export default function QueryInspectorControls( props ) {
{ showInheritControl && (
<ToggleGroupControl
__next40pxDefaultSize
__nextHasNoMarginBottom
label={ __( 'Query type' ) }
isBlock
onChange={ ( value ) => {
Expand Down
Loading