| 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 |
|