import { Panel, PanelBody } from '@wordpress/components'; import { PluginSidebar } from '@wordpress/edit-post'; import { __ } from '@wordpress/i18n'; import React, { useState } from 'react'; import GeneralPanel from './components/GeneralPanel'; import HeaderPanel from './components/HeaderPanel'; import PageHeaderPanel from './components/PageHeaderPanel'; import PrimaryMenuPanel from './components/PrimaryMenuPanel'; import { PanelTypes } from './components/meta.schema'; import './meta.scss'; export const Plugin = () => { const [activePanel, setActivePanel] = useState(PanelTypes.GENERAL); const togglePanel = (panel: string | null) => { setActivePanel((prevActivePanel: any) => prevActivePanel === panel ? null : panel, ); }; return ( } > togglePanel(PanelTypes.GENERAL)} > {activePanel === PanelTypes.GENERAL && } togglePanel(PanelTypes.HEADER)} > {activePanel === PanelTypes.HEADER && } togglePanel(PanelTypes.PRIMARYMENU)} > {activePanel === PanelTypes.PRIMARYMENU && } togglePanel(PanelTypes.PAGEHEADER)} > {activePanel === PanelTypes.PAGEHEADER && } ); };