tidy up inspector controls

This commit is contained in:
Ray Elliott 2020-08-14 18:43:44 +01:00
parent c032afc07a
commit 0a3962690b
1 changed files with 26 additions and 23 deletions

View File

@ -100,7 +100,7 @@ registerBlockType('room-vw/iconify', {
return ( return (
<Fragment> <Fragment>
<InspectorControls> <InspectorControls>
<PanelBody title="Icon settings"> <PanelBody title="Icon size">
<RangeControl <RangeControl
label={`Font size (${attributes.fontUnit})`} label={`Font size (${attributes.fontUnit})`}
value={attributes.fontSize} value={attributes.fontSize}
@ -111,28 +111,31 @@ registerBlockType('room-vw/iconify', {
setAttributes({ fontSize: value }); setAttributes({ fontSize: value });
}} }}
/> />
<PanelRow></PanelRow> <ToggleControl
<PanelRow> label="Use ems"
<ToggleControl checked={attributes.fontUnit === 'em'}
label="Is isInline" onChange={(state) => {
checked={attributes.isInline} setAttributes({
onChange={(state) => { fontUnit: state ? 'em' : 'px',
setAttributes({ isInline: state }); fontSize: state
}} ? attributes.fontSize / 16
/> : attributes.fontSize * 16,
<ToggleControl });
label="Use ems" }}
checked={attributes.fontUnit === 'em'} />
onChange={(state) => { </PanelBody>
setAttributes({ <PanelBody title="Icon variations">
fontUnit: state ? 'em' : 'px', <ToggleControl
fontSize: state label="Inline"
? attributes.fontSize / 16 checked={attributes.isInline}
: attributes.fontSize * 16, onChange={(state) => {
}); setAttributes({ isInline: state });
}} }}
/> />
</PanelRow> <p>Color</p>
<p>Rotate</p>
<p>Flip</p>
<p>Etc</p>
</PanelBody> </PanelBody>
</InspectorControls> </InspectorControls>