PluginProbe
Extendify / 0.9.2
Extendify v0.9.2
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 0.9.2, at src/Library/components/TypeSelect.js

40 lines 1.8 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 className="flex justify-evenly border border-gray-900 p-0.5 rounded">
16 <button
17 type="button"
18 className={classNames({
19 'w-full m-0 min-w-sm cursor-pointer rounded py-2.5 px-4 text-xs leading-none': true,
20 'bg-gray-900 text-white': currentType === 'pattern',
21 'bg-transparent text-black': currentType !== 'pattern',
22 })}
23 onClick={() => updateType('pattern')}>
24 <span className="">{__('Patterns', 'extendify')}</span>
25 </button>
26 <button
27 type="button"
28 className={classNames({
29 'outline-none w-full m-0 -ml-px min-w-sm cursor-pointer items-center rounded-tr-sm rounded-br-sm py-2.5 px-4 text-xs leading-none': true,
30 'bg-gray-900 text-white': currentType === 'template',
31 'bg-transparent text-black': currentType !== 'template',
32 })}
33 onClick={() => updateType('template')}>
34 <span className="">{__('Templates', 'extendify')}</span>
35 </button>
36 </div>
37 </div>
38 )
39 }
40