PluginProbe
Extendify / 0.2.0
Extendify v0.2.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.2.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 { useTemplatesStore } from '../state/Templates'
3 import classNames from 'classnames'
4 import { useGlobalStore } from '../state/GlobalState'
5
6 export const TypeSelect = ({ className }) => {
7 const updateType = useTemplatesStore((state) => state.updateType)
8 const currentType = useGlobalStore((state) =>
9 state.currentType ? 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 'cursor-pointer text-xs leading-none m-0 py-2.5 px-4 min-w-sm border rounded-tl-sm rounded-bl-sm border-black button-focus': 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 'cursor-pointer text-xs leading-none m-0 py-2.5 px-4 min-w-sm items-center border rounded-tr-sm rounded-br-sm border-black outline-none -ml-px button-focus': 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