/**
* Internal dependencies
*/
import applyWithColors from './colors';
/**
* WordPress dependencies
*/
const { __ } = wp.i18n;
const { Component, Fragment } = wp.element;
const { compose } = wp.compose;
const { InspectorControls, PanelColorSettings } = wp.blockEditor;
const { PanelBody, BaseControl } = wp.components;
/**
* Inspector controls
*/
class Inspector extends Component {
constructor() {
super( ...arguments );
this.updateHeight = this.updateHeight.bind( this );
}
updateHeight( newHeight ) {
this.props.setAttributes( { height: newHeight } );
}
render() {
const {
attributes,
setAttributes,
setColor,
color,
} = this.props;
const {
height,
} = attributes;
return (
<Fragment>
<InspectorControls>
<PanelBody title={ __( 'Dynamic HR Settings' ) }>
<BaseControl label={ __( 'Height in pixels' ) }>
<input
type="number"
onChange={ ( event ) => {
setAttributes( {
height: parseInt( event.target.value, 10 ),
} );
} }
aria-label={ __( 'Height for the dynamic separator element in pixels.' ) }
value={ height }
min="20"
step="10"
/>
</BaseControl>
</PanelBody>
<PanelColorSettings
title={ __( 'Color Settings' ) }
initialOpen={ false }
colorSettings={ [
{
value: color.color,
onChange: setColor,
label: __( 'Color' ),
},
] }
>
</PanelColorSettings>
</InspectorControls>
</Fragment>
);
}
}
export default compose( [
applyWithColors,
] )( Inspector );