index.js 885 B

123456789101112131415161718192021222324252627282930
  1. import { registerBlockType } from '@wordpress/blocks';
  2. import { useBlockProps } from '@wordpress/block-editor';
  3. registerBlockType('srh/offcanvas-menu', {
  4. apiVersion: 3,
  5. title: 'Off Canvas Menu',
  6. icon: 'menu',
  7. category: 'srh-blocks',
  8. edit: function() {
  9. const blockProps = useBlockProps({
  10. className: 'wp-block-srh-offcanvas-menu'
  11. });
  12. return (
  13. <div { ...blockProps }>
  14. <button className="hamburger-toggle is-editor" aria-label="Toggle Menu">
  15. <div className="hamburger-lines">
  16. <span></span>
  17. <span></span>
  18. <span></span>
  19. </div>
  20. <span className="menu-text">Menu</span>
  21. </button>
  22. </div>
  23. );
  24. },
  25. save: () => null
  26. });