/** * Inspector Controls */ // Setup the block const { __ } = wp.i18n; const { Component } = wp.element; // Import block components const { InspectorControls, BlockDescription, ColorPalette, PanelColorSettings, MediaUpload, } = wp.editor; // Import Inspector components const { Toolbar, Button, PanelBody, PanelRow, FormToggle, RangeControl, SelectControl, ToggleControl, IconButton, } = wp.components; /** * Create an Inspector Controls wrapper Component */ export default class Inspector extends Component { constructor( props ) { super( ...arguments ); } render() { // Setup the attributes const { containerPaddingTop, containerPaddingRight, containerPaddingBottom, containerPaddingLeft, containerMarginTop, containerMarginBottom, containerMaxWidth, containerBackgroundColor, containerDimRatio, containerImgURL, containerImgID, containerImgAlt } = this.props.attributes; const { setAttributes } = this.props; const onSelectImage = img => { setAttributes( { containerImgID: img.id, containerImgURL: img.url, containerImgAlt: img.alt, } ); }; const onRemoveImage = () => { setAttributes({ containerImgID: null, containerImgURL: null, containerImgAlt: null, }); } // Update color values const onChangeBackgroundColor = value => setAttributes( { containerBackgroundColor: value } ); return ( this.props.setAttributes( { containerPaddingTop: value } ) } min={ 0 } max={ 30 } step={ .5 } /> this.props.setAttributes( { containerPaddingBottom: value } ) } min={ 0 } max={ 30 } step={ .5 } /> this.props.setAttributes( { containerPaddingLeft: value } ) } min={ 0 } max={ 30 } step={ .5 } /> this.props.setAttributes( { containerPaddingRight: value } ) } min={ 0 } max={ 30 } step={ .5 } /> this.props.setAttributes( { containerMarginTop: value } ) } min={ 0 } max={ 30 } step={ 1 } /> this.props.setAttributes( { containerMarginBottom: value } ) } min={ 0 } max={ 30 } step={ .5 } /> this.props.setAttributes( { containerMaxWidth: value } ) } min={ 500 } max={ 1600 } step={ 1 } />

{ __( 'Select a background image:' ) }

(
{ __( 'Select Image' ) } { containerImgURL && !! containerImgURL.length && ( { __( 'Remove' ) } ) }
) } >
{ containerImgURL && !! containerImgURL.length && ( this.props.setAttributes( { containerDimRatio: value } ) } min={ 0 } max={ 100 } step={ 10 } /> ) }
); } }