Skip to content

Commit

Permalink
CheckboxControl: replace margin overrides with new opt-in prop (#45434)
Browse files Browse the repository at this point in the history
* CheckboxControl: replace margin overrides with new opt-in prop

* Fix failing snapshots
  • Loading branch information
brookewp authored Nov 3, 2022
1 parent 8d4958b commit 3325937
Show file tree
Hide file tree
Showing 13 changed files with 23 additions and 17 deletions.
4 changes: 4 additions & 0 deletions packages/block-editor/src/components/block-lock/modal.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
className="block-editor-block-lock-modal__options"
>
<CheckboxControl
__nextHasNoMarginBottom
className="block-editor-block-lock-modal__options-title"
label={
<span id={ instanceId }>{ __( 'Lock all' ) }</span>
Expand All @@ -134,6 +135,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
{ allowsEditLocking && (
<li className="block-editor-block-lock-modal__checklist-item">
<CheckboxControl
__nextHasNoMarginBottom
label={
<>
{ __( 'Restrict editing' ) }
Expand All @@ -158,6 +160,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
) }
<li className="block-editor-block-lock-modal__checklist-item">
<CheckboxControl
__nextHasNoMarginBottom
label={
<>
{ __( 'Disable movement' ) }
Expand All @@ -181,6 +184,7 @@ export default function BlockLockModal( { clientId, onClose } ) {
</li>
<li className="block-editor-block-lock-modal__checklist-item">
<CheckboxControl
__nextHasNoMarginBottom
label={
<>
{ __( 'Prevent removal' ) }
Expand Down
2 changes: 0 additions & 2 deletions packages/block-editor/src/components/block-lock/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
.components-base-control__field {
align-items: center;
display: flex;
margin: 0;
}
}
.block-editor-block-lock-modal__checklist-item {
Expand All @@ -32,7 +31,6 @@
.components-base-control__field {
align-items: center;
display: flex;
margin: 0;
}

.components-checkbox-control__label {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ function BlockManagerCategory( { title, blockTypes } ) {
className="edit-post-block-manager__category"
>
<CheckboxControl
__nextHasNoMarginBottom
checked={ isAllChecked }
onChange={ toggleAllVisible }
className="edit-post-block-manager__category-title"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ function BlockTypesChecklist( { blockTypes, value, onItemChange } ) {
className="edit-post-block-manager__checklist-item"
>
<CheckboxControl
__nextHasNoMarginBottom
label={
<>
{ blockType.title }
Expand Down
1 change: 0 additions & 1 deletion packages/edit-post/src/components/block-manager/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@
.components-base-control__field {
align-items: center;
display: flex;
margin: 0;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ export default function EntityRecordItem( {
return (
<PanelRow>
<CheckboxControl
__nextHasNoMarginBottom
label={
<strong>
{ decodeEntities( entityRecordTitle ) ||
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/post-comments/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function PostComments( { commentStatus = 'open', ...props } ) {

return (
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Allow comments' ) }
checked={ commentStatus === 'open' }
onChange={ onToggleComments }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export function PostPendingStatus( { status, onUpdateStatus } ) {
return (
<PostPendingStatusCheck>
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Pending review' ) }
checked={ status === 'pending' }
onChange={ togglePendingStatus }
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/post-pingbacks/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ function PostPingbacks( { pingStatus = 'open', ...props } ) {

return (
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Allow pingbacks & trackbacks' ) }
checked={ pingStatus === 'open' }
onChange={ onTogglePingback }
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/post-publish-panel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,7 @@ export class PostPublishPanel extends Component {
</div>
<div className="editor-post-publish-panel__footer">
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Always show pre-publish checks.' ) }
checked={ isPublishSidebarEnabled }
onChange={ onTogglePublishSidebar }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
padding: 0;
}
.components-panel__row .emotion-8 {
margin-bottom: inherit;
}
<div>
<div
class="editor-post-publish-panel"
Expand Down Expand Up @@ -141,7 +145,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is pu
class="components-base-control components-checkbox-control emotion-0 emotion-1"
>
<div
class="components-base-control__field emotion-2 emotion-3"
class="components-base-control__field emotion-8 emotion-3"
>
<span
class="components-checkbox-control__input-container"
Expand Down Expand Up @@ -197,6 +201,10 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
padding: 0;
}
.components-panel__row .emotion-8 {
margin-bottom: inherit;
}
<div>
<div
class="editor-post-publish-panel"
Expand Down Expand Up @@ -307,7 +315,7 @@ exports[`PostPublishPanel should render the post-publish panel if the post is sc
class="components-base-control components-checkbox-control emotion-0 emotion-1"
>
<div
class="components-base-control__field emotion-2 emotion-3"
class="components-base-control__field emotion-8 emotion-3"
>
<span
class="components-checkbox-control__input-container"
Expand Down Expand Up @@ -345,10 +353,6 @@ exports[`PostPublishPanel should render the pre-publish panel if post status is
box-sizing: inherit;
}
.emotion-2 {
margin-bottom: calc(4px * 2);
}
.components-panel__row .emotion-2 {
margin-bottom: inherit;
}
Expand Down Expand Up @@ -472,10 +476,6 @@ exports[`PostPublishPanel should render the pre-publish panel if the post is not
box-sizing: inherit;
}
.emotion-2 {
margin-bottom: calc(4px * 2);
}
.components-panel__row .emotion-2 {
margin-bottom: inherit;
}
Expand Down Expand Up @@ -641,10 +641,6 @@ exports[`PostPublishPanel should render the spinner if the post is being saved 1
box-sizing: inherit;
}
.emotion-8 {
margin-bottom: calc(4px * 2);
}
.components-panel__row .emotion-8 {
margin-bottom: inherit;
}
Expand Down
1 change: 1 addition & 0 deletions packages/editor/src/components/post-sticky/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function PostSticky( { onUpdateSticky, postSticky = false } ) {
return (
<PostStickyCheck>
<CheckboxControl
__nextHasNoMarginBottom
label={ __( 'Stick to the top of the blog' ) }
checked={ postSticky }
onChange={ () => onUpdateSticky( ! postSticky ) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,7 @@ export function HierarchicalTermSelector( { slug } ) {
className="editor-post-taxonomies__hierarchical-terms-choice"
>
<CheckboxControl
__nextHasNoMarginBottom
checked={ terms.indexOf( term.id ) !== -1 }
onChange={ () => {
const termId = parseInt( term.id, 10 );
Expand Down

0 comments on commit 3325937

Please sign in to comment.