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 / pages / layout / Toolbar.js

Toolbar.js in Extendify 0.2.0, at src/pages/layout/Toolbar.js

44 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 { Icon, close } from '@wordpress/icons'
3 import { Button } from '@wordpress/components'
4 import { TypeSelect } from '../../components/TypeSelect'
5 import { useGlobalStore } from '../../state/GlobalState'
6 import { user } from '../../components/icons/'
7 import SettingsModal from '../../components/modals/SettingsModal'
8 import { useUserStore } from '../../state/User'
9
10 export const Toolbar = ({ className }) => {
11 const setOpen = useGlobalStore((state) => state.setOpen)
12 const setCurrentModal = useGlobalStore((state) => state.setCurrentModal)
13 const loggedIn = useUserStore((state) => state.apiKey.length)
14
15 return (
16 <div className={className}>
17 <div className="flex justify-between items-center h-full">
18 <div className="flex-1"></div>
19 <TypeSelect className="flex-1 flex items-center justify-center" />
20 <div className="flex-1 flex justify-end items-center">
21 <Button
22 onClick={() =>
23 setCurrentModal(
24 <SettingsModal
25 isOpen={true}
26 onClose={() => setCurrentModal(null)}
27 />,
28 )
29 }
30 icon={<Icon icon={user} size={24} />}
31 label={__('Login and settings area', 'extendify')}>
32 {loggedIn ? '' : __('Log In', 'extendify')}
33 </Button>
34 <Button
35 onClick={() => setOpen(false)}
36 icon={<Icon icon={close} size={24} />}
37 label={__('Close library', 'extendify')}
38 />
39 </div>
40 </div>
41 </div>
42 )
43 }
44