Jake Vanderwerf
2026-01-01 3acb42faee66868a76e653a34ef35de13ddf734f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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>
        </>
    );
}