import { CheckboxControl, Flex, PanelRow, SelectControl, withFilters, } from '@wordpress/components'; import { applyFilters } from '@wordpress/hooks'; import { __ } from '@wordpress/i18n'; import React from 'react'; import { withMeta } from '../hoc/withMeta'; import { ContainedSidebar, Customizer, LeftSidebar, RightSidebar, StretchedSidebar, } from './Icons'; import { MetaProps } from './types'; const OPTIONS = applyFilters('elearning.meta.general.layout', [ { label: __('Customizer', 'elearning'), icon: Customizer, value: 'tg-site-layout--default', }, { label: __('Left Sidebar', 'elearning'), icon: LeftSidebar, value: 'tg-site-layout--left', }, { label: __('Right Sidebar', 'elearning'), icon: RightSidebar, value: 'tg-site-layout--right', }, { label: __('Contained Sidebar', 'elearning'), icon: ContainedSidebar, value: 'tg-site-layout--no-sidebar', }, { label: __('Stretched Sidebar', 'elearning'), icon: StretchedSidebar, value: 'tg-site-layout--stretched', }, ]) as Array<{ label: string; icon: React.ElementType; value: string; }>; const GeneralPanel = ({ meta, updateMeta }: MetaProps) => { const currentLayout = meta?.elearning_layout ?? 'customizer'; return (

{__('Layout', 'elearning')}

{OPTIONS?.map((option) => { const Icon = option.icon; return ( { updateMeta?.('elearning_layout', option.value); }} > ); })}

{__('Remove content padding', 'elearning')}

{ updateMeta?.('elearning_remove_content_margin', val); }} className="checkboxWidth" />

{__('Sidebar', 'elearning')}

{ updateMeta?.('elearning_sidebar', value); }} size="__unstable-large" value={meta?.elearning_sidebar} options={[ { label: __('Default', 'elearning'), value: 'default', }, { label: __('Sidebar Right', 'elearning'), value: 'sidebar-right', }, { label: __('Sidebar Left', 'elearning'), value: 'sidebar-left', }, { label: __('Footer One', 'elearning'), value: 'footer-sidebar-1', }, { label: __('Footer Two', 'elearning'), value: 'footer-sidebar-2', }, { label: __('Footer Three', 'elearning'), value: 'footer-sidebar-3', }, { label: __('Footer Four', 'elearning'), value: 'footer-sidebar-4', }, ]} />
); }; // @ts-ignore export default withMeta(withFilters('eLearningMetaGeneralPanel')(GeneralPanel));