import { InspectorControls } from '@wordpress/block-editor'; import { PanelBody, BaseControl, SelectControl, Button, CheckboxControl, } from '@wordpress/components'; import { __ } from '@wordpress/i18n'; import { Theme } from 'shiki'; import { useLanguage } from '../../hooks/useLanguage'; import { useGlobalStore } from '../../state/global'; import { useLanguageStore } from '../../state/language'; import { useThemeStore } from '../../state/theme'; import { AttributesPropsAndSetter } from '../../types'; import { languages } from '../../util/languages'; import { FontSizeSelect, FontLineHeightSelect, FontFamilySelect, } from '../components/FontSelect'; import { HeaderSelect } from '../components/HeaderSelect'; import { Notice } from '../components/Notice'; import { ThemeSelect } from '../components/ThemeSelect'; export const SidebarControls = ({ attributes, setAttributes, }: AttributesPropsAndSetter) => { const [language, setLanguage] = useLanguage({ attributes, setAttributes }); const { recentLanguages } = useLanguageStore(); const { updateThemeHistory } = useThemeStore(); const { setPreviousSettings } = useGlobalStore(); return (
({ label, value, }), )} /> {recentLanguages?.length > 0 ? ( <> {__('Recently Used', 'code-block-pro')}
{recentLanguages?.map((lang) => ( ))}
) : null}

{__('Font Size', 'code-block-pro')}

{ setAttributes({ fontSize }); updateThemeHistory({ ...attributes, fontSize }); }} />

{__('Line Height', 'code-block-pro')}

{ setAttributes({ lineHeight }); updateThemeHistory({ ...attributes, lineHeight, }); }} /> { setAttributes({ fontFamily }); updateThemeHistory({ ...attributes, fontFamily, }); }} />
{ console.log({ headerType }); setAttributes({ headerType }); updateThemeHistory({ ...attributes, headerType }); }} /> { setAttributes({ theme: slug }); updateThemeHistory({ ...attributes, theme: slug }); }} /> { setPreviousSettings({ copyButton: value }); setAttributes({ copyButton: value }); }} />
); };