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

MainWindow.js in Extendify 0.9.2, at src/Library/pages/MainWindow.js

45 lines 1.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { useRef } from '@wordpress/element'
2 import { Dialog } from '@headlessui/react'
3 import FooterNotice from '@library/components/notices/FooterNotice'
4 import { useModal } from '@library/hooks/useModal'
5 import { useGlobalStore } from '@library/state/GlobalState'
6 import { Layout } from './layout/Layout'
7
8 export default function MainWindow() {
9 const containerRef = useRef(null)
10 const open = useGlobalStore((state) => state.open)
11 const setOpen = useGlobalStore((state) => state.setOpen)
12 const modal = useModal(open)
13 const ready = useGlobalStore((state) => state.ready)
14
15 return (
16 <Dialog
17 as="div"
18 className="extendify"
19 initialFocus={containerRef}
20 open={open}
21 onClose={() => setOpen(false)}>
22 <div className="fixed inset-0 bg-black bg-opacity-40 transition-opacity" />
23 <div className="fixed inset-0 z-high m-auto h-screen w-screen overflow-y-auto sm:h-auto sm:w-auto">
24 <div className="flex min-h-screen items-end justify-center px-4 pt-4 pb-20 text-center sm:block sm:p-0">
25 <div
26 ref={containerRef}
27 tabIndex="0"
28 onClick={(e) =>
29 e.target === e.currentTarget && setOpen(false)
30 }
31 className="fixed inset-0 transform p-2 transition-all lg:absolute lg:overflow-hidden lg:p-16">
32 <Layout />
33 {ready ? (
34 <>
35 <FooterNotice />
36 {modal}
37 </>
38 ) : null}
39 </div>
40 </div>
41 </div>
42 </Dialog>
43 )
44 }
45