Skip to content

Commit

Permalink
Update to switch toggle to preceed controls
Browse files Browse the repository at this point in the history
Addresses concern raised in #16790
  • Loading branch information
getdave committed Sep 16, 2019
1 parent 37b8f27 commit 619ef71
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,15 +43,16 @@ function ResponsiveBlockControl( props ) {
<legend className="block-editor-responsive-block-control__legend">{ legend }</legend>

<div className="block-editor-responsive-block-control__inner">
{ ! isOpen && defaultControl }

{ isOpen && ( renderResponsiveControls ? renderResponsiveControls() : defaultResponsiveControls ) }

<ToggleControl
label={ toggleControlLabel }
checked={ ! isOpen }
onChange={ onToggle }
/>

{ ! isOpen && defaultControl }

{ isOpen && ( renderResponsiveControls ? renderResponsiveControls() : defaultResponsiveControls ) }

</div>
</fieldset>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Basic rendering should render with required props 1`] = `"<fieldset class=\\"block-editor-responsive-block-control\\"><legend class=\\"block-editor-responsive-block-control__legend\\">Padding</legend><div class=\\"block-editor-responsive-block-control__inner\\"><fieldset><legend>All</legend><input value=\\"All\\"></fieldset><div class=\\"components-base-control components-toggle-control\\"><div class=\\"components-base-control__field\\"><span class=\\"components-form-toggle is-checked\\"><input class=\\"components-form-toggle__input\\" id=\\"inspector-toggle-control-0\\" type=\\"checkbox\\" checked=\\"\\"><span class=\\"components-form-toggle__track\\"></span><span class=\\"components-form-toggle__thumb\\"></span><svg class=\\"components-form-toggle__on\\" width=\\"2\\" height=\\"6\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 2 6\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M0 0h2v6H0z\\"></path></svg></span><label for=\\"inspector-toggle-control-0\\" class=\\"components-toggle-control__label\\">Use the same padding on all screensizes.</label></div></div></div></fieldset>"`;
exports[`Basic rendering should render with required props 1`] = `"<fieldset class=\\"block-editor-responsive-block-control\\"><legend class=\\"block-editor-responsive-block-control__legend\\">Padding</legend><div class=\\"block-editor-responsive-block-control__inner\\"><div class=\\"components-base-control components-toggle-control\\"><div class=\\"components-base-control__field\\"><span class=\\"components-form-toggle is-checked\\"><input class=\\"components-form-toggle__input\\" id=\\"inspector-toggle-control-0\\" type=\\"checkbox\\" checked=\\"\\"><span class=\\"components-form-toggle__track\\"></span><span class=\\"components-form-toggle__thumb\\"></span><svg class=\\"components-form-toggle__on\\" width=\\"2\\" height=\\"6\\" xmlns=\\"http://www.w3.org/2000/svg\\" viewBox=\\"0 0 2 6\\" role=\\"img\\" aria-hidden=\\"true\\" focusable=\\"false\\"><path d=\\"M0 0h2v6H0z\\"></path></svg></span><label for=\\"inspector-toggle-control-0\\" class=\\"components-toggle-control__label\\">Use the same padding on all screensizes.</label></div></div><fieldset><legend>All</legend><input value=\\"All\\"></fieldset></div></fieldset>"`;

0 comments on commit 619ef71

Please sign in to comment.