Jake Vanderwerf
5 days ago a9b3b28d001941921aa70d37fdc87c758a163a44
src/drawer-menu/edit.js
New file
@@ -0,0 +1,33 @@
import { useBlockProps, InspectorControls } from '@wordpress/block-editor';
import { PanelBody, ToggleControl, TextControl } from '@wordpress/components';
export default function Edit({ attributes, setAttributes }) {
   const { menuId, collapsed } = attributes;
   const blockProps = useBlockProps();
   return (
      <>
         <InspectorControls>
            <PanelBody title="Drawer Settings">
               <TextControl
                  label="Menu ID"
                  value={menuId}
                  onChange={(value) => setAttributes({ menuId: value })}
                  help="PHP-generated menu identifier"
               />
               <ToggleControl
                  label="Start Collapsed"
                  checked={collapsed}
                  onChange={(value) => setAttributes({ collapsed: value })}
               />
            </PanelBody>
         </InspectorControls>
         <div {...blockProps}>
            <div className="drawer-menu-preview">
               <p>Drawer Menu: {menuId || 'Not configured'}</p>
               <p>State: {collapsed ? 'Collapsed' : 'Expanded'}</p>
            </div>
         </div>
      </>
   );
}