PluginProbe
Extendify / 3.1.0
Extendify v3.1.0
3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 0.7.0 All 126 releases
extendify / src / Library / components / MainButton.jsx

MainButton.jsx in Extendify 3.1.0, at src/Library/components/MainButton.jsx

40 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { extendifyLogo } from '@library/icons/extendify-logo';
2 import { useGlobalsStore } from '@library/state/global';
3 import { useActivityStore } from '@shared/state/activity';
4 import { __ } from '@wordpress/i18n';
5 import { Icon } from '@wordpress/icons';
6
7 export const MainButton = () => {
8 const { setOpen } = useGlobalsStore();
9 const { incrementActivity } = useActivityStore();
10
11 const handleClick = () => {
12 // Minimize HC if its open
13 window.dispatchEvent(new CustomEvent('extendify-hc:minimize'));
14 setOpen(true);
15 incrementActivity('library-button-click');
16 };
17
18 return (
19 // biome-ignore lint: allow a button here
20 <div
21 role="button"
22 tabIndex={0}
23 onClick={handleClick}
24 onKeyDown={(e) => {
25 if (!(e.key === 'Enter' || e.key === ' ')) return;
26 handleClick();
27 }}
28 className="components-button has-icon is-primary h-8 min-w-0 cursor-pointer px-2 xs:h-9 sm:ml-2 xl:pr-3"
29 >
30 <Icon
31 icon={extendifyLogo(__('Design Library', 'extendify-local'))}
32 size={24}
33 />
34 <span className="ml-1 hidden xl:inline">
35 {__('Design Library', 'extendify-local')}
36 </span>
37 </div>
38 );
39 };
40