Skip to content

Instantly share code, notes, and snippets.

@gutengeek
Created June 22, 2020 16:00
Show Gist options
  • Save gutengeek/c071c74207a890ac1b48854c3f9a97e5 to your computer and use it in GitHub Desktop.
Save gutengeek/c071c74207a890ac1b48854c3f9a97e5 to your computer and use it in GitHub Desktop.
// import via npm
import Components from "@gutengeek/components";
import '@gutengeek/components/build/core.css';
import '@gutengeek/components/build/index.css';
const {
ShapeControl
} = Components;
/**
* GutenBerg dependencies
*/
const {
InspectorControls
} = wp.blockEditor;
const { __ } = wp.i18n;
const {
PanelBody,
} = wp.components;
export default function MyComponent( props ) {
const {
attributes: {
shape
},
setAttributes
} = props
const [ device, setDevice ] = useState( 'desktop' );
return <InspectorControls>
<PanelBody title={ __('My Panel Body') }>
<ShapeControl value={ shape }
device={ device }
onChangeDevice={ ( device ) => setDevice( device ) }
onChange={ ( value ) => setAttributes( { shape: value } ) }
/>
</PanelBody>
</InspectorControls>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment