/** * Internal dependencies. */ import Margin from './../../../utils/components/margin'; import Padding from './../../../utils/components/padding'; /** * WordPress dependencies. */ const { __ } = wp.i18n; const { Component } = wp.element; const { compose } = wp.compose; const { InspectorControls, PanelColorSettings, withColors, ContrastChecker, } = wp.editor; const { PanelBody, ToggleControl, SelectControl, } = wp.components; /** * Create an Inspector Controls wrapper Component. */ class Inspector extends Component { constructor( props ) { super( ...arguments ); } render() { const { backgroundColor, setBackgroundColor, textColor, setTextColor, attributes, setAttributes, } = this.props; /* CSS Units. */ const cssUnits = [ { value: 'px', label: __( 'Pixel (px)', 'atomic-blocks' ) }, { value: '%', label: __( 'Percent (%)', 'atomic-blocks' ) }, { value: 'em', label: __( 'Em (em)', 'atomic-blocks' ) }, ]; return ( this.props.setAttributes( { marginUnit: value } ) } /> this.props.setAttributes( { marginSync: ! attributes.marginSync } ) } /> { ! attributes.marginSync ? setAttributes( { marginTop } ) } /* Margin bottom. */ marginEnableBottom={ true } marginBottom={ attributes.marginBottom } marginBottomMin="0" marginBottomMax="200" onChangeMarginBottom={ marginBottom => setAttributes( { marginBottom } ) } /> : setAttributes( { margin } ) } /> }
this.props.setAttributes( { paddingUnit: value } ) } /> this.props.setAttributes( { paddingSync: ! attributes.paddingSync } ) } /> { ! attributes.paddingSync ? setAttributes( { paddingTop } ) } /* Padding right. */ paddingEnableRight={ true } paddingRight={ attributes.paddingRight } paddingRightMin="0" paddingRightMax="200" onChangePaddingRight={ paddingRight => setAttributes( { paddingRight } ) } /* Padding bottom. */ paddingEnableBottom={ true } paddingBottom={ attributes.paddingBottom } paddingBottomMin="0" paddingBottomMax="200" onChangePaddingBottom={ paddingBottom => setAttributes( { paddingBottom } ) } /* Padding left. */ paddingEnableLeft={ true } paddingLeft={ attributes.paddingLeft } paddingLeftMin="0" paddingLeftMax="200" onChangePaddingLeft={ paddingLeft => setAttributes( { paddingLeft } ) } /> : setAttributes( { padding } ) } /> }
); } } export default compose( [ withColors( 'backgroundColor', { textColor: 'color' }, ), ] )( Inspector );