Skip to content

Commit

Permalink
Block Editor: Unify responsive block control group wrapper
Browse files Browse the repository at this point in the history
  • Loading branch information
aduth committed Jan 17, 2020
1 parent d83f4cc commit 288cd55
Showing 1 changed file with 19 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
/**
* External dependencies
*/
import classnames from 'classnames';

/**
* WordPress dependencies
*/
import { __, sprintf } from '@wordpress/i18n';

import { Fragment } from '@wordpress/element';

import {
ToggleControl,
} from '@wordpress/components';
Expand Down Expand Up @@ -76,19 +79,20 @@ function ResponsiveBlockControl( props ) {
onChange={ onIsResponsiveChange }
help={ toggleHelpText }
/>

{ ! isResponsive && (
<div className="block-editor-responsive-block-control__group" >
{ defaultControl }
</div>
) }

{ isResponsive && (
<div className="block-editor-responsive-block-control__group is-responsive" hidden={ ! isResponsive }>
{ ( renderResponsiveControls ? renderResponsiveControls( viewports ) : defaultResponsiveControls() ) }
</div>
) }

<div
className={
classnames( 'block-editor-responsive-block-control__group', {
'is-responsive': isResponsive,
} )
}
>
{ ! isResponsive && defaultControl }
{ isResponsive && (
renderResponsiveControls ?
renderResponsiveControls( viewports ) :
defaultResponsiveControls()
) }
</div>
</div>
</fieldset>
);
Expand Down

0 comments on commit 288cd55

Please sign in to comment.