/** * Inspector Controls. */ /** * External dependencies. */ import map from 'lodash/map'; import columnLayouts from './column-layouts'; import Margin from './../../../utils/components/margin'; import Padding from './../../../utils/components/padding'; /** * WordPress dependencies. */ const { __ } = wp.i18n; const { Component, Fragment } = wp.element; const { InspectorControls, PanelColorSettings, ContrastChecker, } = wp.editor; const { PanelBody, RangeControl, ButtonGroup, Button, Tooltip, ToggleControl, SelectControl, } = wp.components; /** * Create an Inspector Controls wrapper Component */ export default class Inspector extends Component { constructor( props ) { super( ...arguments ); } render() { const { attributes, setAttributes, backgroundColor, setBackgroundColor, textColor, setTextColor, } = this.props; let selectedRows = 1; if ( attributes.columns ) { selectedRows = parseInt( attributes.columns.toString().split('-') ); } /* CSS Units */ const cssUnits = [ { value: 'px', label: __( 'Pixel (px)', 'atomic-blocks' ) }, { value: '%', label: __( 'Percent (%)', 'atomic-blocks' ) }, { value: 'em', label: __( 'Em (em)', 'atomic-blocks' ) }, ]; return ( { attributes.layout && /* Show the column settings once a layout is selected. */ this.props.setAttributes( { columns: value, layout: 'ab-' + value + '-col-equal', } ) } min={ 1 } max={ 6 } step={ 1 } />
{ ( attributes.columns == 2 || attributes.columns == 3 || attributes.columns == 4 ) &&

{ __( 'Column Layout', 'atomic-blocks' ) }

{ map( columnLayouts[ selectedRows ], ( { name, key, icon, col } ) => ( ) ) }

{ __( 'Change the layout of your columns.', 'atomic-blocks' ) }


} this.props.setAttributes( { columnsGap: value } ) } min={ 0 } max={ 10 } step={ 1 } />
this.props.setAttributes( { columnMaxWidth: value } ) } min={ 0 } max={ 2000 } step={ 1 } /> { attributes.columnMaxWidth > 0 && this.props.setAttributes( { centerColumns: ! attributes.centerColumns } ) } /> }
this.props.setAttributes( { responsiveToggle: ! attributes.responsiveToggle } ) } />
} 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 } ) } /> }
); } }