PluginProbe
Extendify / 1.9.3
Extendify v1.9.3
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 / TypeSelect.js

TypeSelect.js in Extendify 1.9.3, at src/Library/components/TypeSelect.js

48 lines 2.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { __ } from '@wordpress/i18n'
2 import classNames from 'classnames'
3 import { useGlobalStore } from '@library/state/GlobalState'
4 import { useTemplatesStore } from '@library/state/Templates'
5
6 export const TypeSelect = ({ className }) => {
7 const updateType = useTemplatesStore((state) => state.updateType)
8 const currentType = useGlobalStore(
9 (state) => state?.currentType ?? 'pattern',
10 )
11
12 return (
13 <div className={className}>
14 <h4 className="sr-only">{__('Type select', 'extendify')}</h4>
15 <div
16 id="patterns-toggle"
17 className="flex justify-evenly border border-gray-900 p-0.5 rounded">
18 <button
19 type="button"
20 className={classNames({
21 'w-full m-0 min-w-sm cursor-pointer rounded py-2.5 px-4 text-xs leading-none': true,
22 'bg-gray-900 text-white': currentType === 'pattern',
23 'bg-design-main':
24 window.extendifyData?.partnerLogo &&
25 currentType === 'pattern',
26 'bg-transparent text-black': currentType !== 'pattern',
27 })}
28 onClick={() => updateType('pattern')}>
29 <span className="">{__('Patterns', 'extendify')}</span>
30 </button>
31 <button
32 type="button"
33 className={classNames({
34 'outline-none w-full m-0 -ml-px min-w-sm cursor-pointer items-center rounded py-2.5 px-4 text-xs leading-none': true,
35 'bg-gray-900 text-white': currentType === 'template',
36 'bg-design-main':
37 window.extendifyData?.partnerLogo &&
38 currentType === 'template',
39 'bg-transparent text-black': currentType !== 'template',
40 })}
41 onClick={() => updateType('template')}>
42 <span className="">{__('Templates', 'extendify')}</span>
43 </button>
44 </div>
45 </div>
46 )
47 }
48