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

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

54 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/FooterNotice'
6
7 export default function MainWindow() {
8 const containerRef = useRef(null)
9 const open = useGlobalStore((state) => state.open)
10 const setOpen = useGlobalStore((state) => state.setOpen)
11 const ModalStore = useGlobalStore((state) => state.currentModal)
12
13 return (
14 <Transition appear show={open} as={Fragment}>
15 <Dialog
16 as="div"
17 static
18 className="extendify"
19 initialFocus={containerRef}
20 onClose={() => setOpen(false)}>
21 <div className="h-screen w-screen sm:h-auto m-auto sm:w-auto fixed z-high inset-0 overflow-y-auto">
22 <div className="flex items-end justify-center min-h-screen pt-4 px-4 pb-20 text-center sm:block sm:p-0">
23 <Transition.Child
24 as={Fragment}
25 enter="ease-out duration-300"
26 enterFrom="opacity-0"
27 enterTo="opacity-100">
28 <Dialog.Overlay className="fixed inset-0 bg-black bg-opacity-40 transition-opacity" />
29 </Transition.Child>
30 <Transition.Child
31 as={Fragment}
32 enter="ease-out duration-300"
33 enterFrom="opacity-0 translate-y-4 sm:translate-y-5"
34 enterTo="opacity-100 translate-y-0">
35 <div
36 ref={containerRef}
37 tabIndex="0"
38 onClick={(e) =>
39 e.target === e.currentTarget &&
40 setOpen(false)
41 }
42 className="fixed lg:absolute inset-0 lg:overflow-hidden transform transition-all p-2 lg:p-16">
43 <Layout />
44 <FooterNotice />
45 {ModalStore}
46 </div>
47 </Transition.Child>
48 </div>
49 </div>
50 </Dialog>
51 </Transition>
52 )
53 }
54