PluginProbe
Code Block Pro – Beautiful Syntax Highlighting / 1.27.6
Code Block Pro – Beautiful Syntax Highlighting v1.27.6
1.27.1 1.27.2 1.27.3 1.27.4 1.27.5 1.27.6 1.27.7 1.28.0 1.3.0 1.4.0 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.8.0 1.9.0 1.9.1 1.9.2 1.9.3 trunk 1.1.0 1.10.0 1.11.0 1.11.1 All 63 releases
code-block-pro / src / editor / components / ThemesPanel.tsx

ThemesPanel.tsx in Code Block Pro – Beautiful Syntax Highlighting 1.27.6, at src/editor/components/ThemesPanel.tsx

37 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { PanelBody } from '@wordpress/components';
2 import { useState } from '@wordpress/element';
3 import { __ } from '@wordpress/i18n';
4 import { Theme } from 'shiki';
5 import { useSettingsStoreReady } from '../../state/settings';
6 import { useThemeStore } from '../../state/theme';
7 import { AttributesPropsAndSetter } from '../../types';
8 import { ThemeFilter } from './ThemeFilter';
9 import { ThemeSelect } from './ThemeSelect';
10
11 export const ThemesPanel = ({
12 bringAttentionToThemes,
13 attributes,
14 setAttributes,
15 }: AttributesPropsAndSetter & { bringAttentionToThemes?: boolean }) => {
16 const { updateThemeHistory } = useThemeStore();
17 const [search, setSearch] = useState<string>('');
18 const ready = useSettingsStoreReady();
19 return (
20 <PanelBody
21 title={__('Theme', 'code-block-pro')}
22 initialOpen={bringAttentionToThemes ?? false}>
23 {ready && <ThemeFilter search={search} setSearch={setSearch} />}
24 {ready && (
25 <ThemeSelect
26 {...attributes}
27 search={search}
28 onClick={(theme: Theme) => {
29 setAttributes({ theme });
30 updateThemeHistory({ theme });
31 }}
32 />
33 )}
34 </PanelBody>
35 );
36 };
37