PluginProbe
Extendify / 0.4.0
Extendify v0.4.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 / MainWindow.js

MainWindow.js in Extendify 0.4.0, at src/pages/MainWindow.js

55 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 import { Fragment, useRef } from '@wordpress/element'
2 import { Dialog, Transition } from '@headlessui/react'
3 import { useGlobalStore } from '../state/GlobalState'
4 import { Layout } from './layout/Layout'
5 import FooterNotice from '../components/notices/FooterNotice'
6 import { useModal } from '../hooks/useModal'
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
14 return (
15 <Transition appear show={open} as={Fragment}>
16 <Dialog
17 as="div"
18 static
19 className="extendify"
20 initialFocus={containerRef}
21 onClose={() => setOpen(false)}>
22 <div className="h-screen w-screen sm:h-auto m-auto sm:w-auto fixed z-high inset-0 overflow-y-auto">
23 <div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
24 <Transition.Child
25 as={Fragment}
26 enter="ease-out duration-300"
27 enterFrom="opacity-0"
28 enterTo="opacity-100">
29 <Dialog.Overlay className="fixed inset-0 bg-black bg-opacity-40 transition-opacity" />
30 </Transition.Child>
31 <Transition.Child
32 as={Fragment}
33 enter="ease-out duration-300"
34 enterFrom="opacity-0 translate-y-4 sm:translate-y-5"
35 enterTo="opacity-100 translate-y-0">
36 <div
37 ref={containerRef}
38 tabIndex="0"
39 onClick={(e) =>
40 e.target === e.currentTarget &&
41 setOpen(false)
42 }
43 className="fixed lg:absolute inset-0 lg:overflow-hidden transform transition-all p-2 lg:p-16">
44 <Layout />
45 <FooterNotice />
46 {modal}
47 </div>
48 </Transition.Child>
49 </div>
50 </div>
51 </Dialog>
52 </Transition>
53 )
54 }
55