PluginProbe
Extendify / 0.6.0
Extendify v0.6.0
3.2.1 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 All 127 releases
extendify / src / components / TypeSelect.js

TypeSelect.js in Extendify 0.6.0, at src/components/TypeSelect.js

38 lines 1.7 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 '@extendify/state/GlobalState'
4 import { useTemplatesStore } from '@extendify/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 <button
16 type="button"
17 className={classNames({
18 'button-focus m-0 min-w-sm cursor-pointer rounded-tl-sm rounded-bl-sm border border-black py-2.5 px-4 text-xs leading-none': true,
19 'bg-gray-900 text-white': currentType === 'pattern',
20 'bg-transparent text-black': currentType !== 'pattern',
21 })}
22 onClick={() => updateType('pattern')}>
23 <span className="">{__('Patterns', 'extendify')}</span>
24 </button>
25 <button
26 type="button"
27 className={classNames({
28 'outline-none button-focus m-0 -ml-px min-w-sm cursor-pointer items-center rounded-tr-sm rounded-br-sm border border-black py-2.5 px-4 text-xs leading-none': true,
29 'bg-gray-900 text-white': currentType === 'template',
30 'bg-transparent text-black': currentType !== 'template',
31 })}
32 onClick={() => updateType('template')}>
33 <span className="">{__('Page Layouts', 'extendify')}</span>
34 </button>
35 </div>
36 )
37 }
38