Skip to content

Instantly share code, notes, and snippets.

@alanef
Created April 1, 2022 14:55
Show Gist options
  • Select an option

  • Save alanef/30fddd3a43a1eb83b9d002b333c061bd to your computer and use it in GitHub Desktop.

Select an option

Save alanef/30fddd3a43a1eb83b9d002b333c061bd to your computer and use it in GitHub Desktop.
export default function Edit(props) {
const {attributes, setAttributes} = props
const UnitSelector = () => {
const updateUnits = (val) => {
setAttributes({units: val});
}
return (
<TextControl
label={__('Enter Units', 'blocks-for-weatherlink')}
help={__('Knots, MPH, KPH', 'blocks-for-weatherlink')}
type="text"
value={attributes.units}
onChange={updateUnits}
/>
)
}
return (
<div {...useBlockProps()}>
<InspectorControls>
<Panel header={__('Weatherlink Settings', 'blocks-for-weatherlink')}>
<PanelBody title={__('Units', 'blocks-for-weatherlink')} initialOpen={true}>
<UnitSelector/>
</PanelBody>
</Panel>
</InspectorControls>
<p> DUMMY OUTPUT </p>
</div>
);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment