| 1 |
import { Icon, close } from '@wordpress/icons' |
| 2 |
import { __ } from '@wordpress/i18n' |
| 3 |
import { Dialog, Transition } from '@headlessui/react' |
| 4 |
import { Fragment } from '@wordpress/element' |
| 5 |
|
| 6 |
export default function SplitModal({ onRequestClose, isOpen, left, right }) { |
| 7 |
return ( |
| 8 |
<Transition.Root appear show={true} as={Fragment}> |
| 9 |
<Dialog |
| 10 |
as="div" |
| 11 |
static |
| 12 |
open={isOpen} |
| 13 |
className="extendify" |
| 14 |
onClose={onRequestClose}> |
| 15 |
<div className="fixed z-high inset-0 flex"> |
| 16 |
<Transition.Child |
| 17 |
as={Fragment} |
| 18 |
enter="ease-out duration-50 transition" |
| 19 |
enterFrom="opacity-0" |
| 20 |
enterTo="opacity-100"> |
| 21 |
<Dialog.Overlay className="fixed inset-0 bg-black bg-opacity-40 transition-opacity" /> |
| 22 |
</Transition.Child> |
| 23 |
<Transition.Child |
| 24 |
as={Fragment} |
| 25 |
enter="ease-out duration-300 translate transform" |
| 26 |
enterFrom="opacity-0 translate-y-4 sm:translate-y-5" |
| 27 |
enterTo="opacity-100 translate-y-0"> |
| 28 |
<div className="m-auto"> |
| 29 |
<div className="shadow-modal relative m-8 md:m-0 max-w-md rounded-sm md:flex bg-gray-100 items-center justify-center md:max-w-2xl"> |
| 30 |
<button |
| 31 |
onClick={onRequestClose} |
| 32 |
className="absolute bg-transparent block p-4 top-0 right-0 rounded-md cursor-pointer text-gray-700 opacity-30 hover:opacity-100"> |
| 33 |
<span className="sr-only"> |
| 34 |
{__('Close', 'extendify')} |
| 35 |
</span> |
| 36 |
<Icon icon={close} /> |
| 37 |
</button> |
| 38 |
<div className="rounded-md md:rounded-l-md md:rounded-tr-none bg-white p-12 text-center md:w-7/12 items-center"> |
| 39 |
{left} |
| 40 |
</div> |
| 41 |
<div className="justify-center md:justify-none md:w-6/12 p-10 text-black hidden md:block "> |
| 42 |
{right} |
| 43 |
</div> |
| 44 |
</div> |
| 45 |
</div> |
| 46 |
</Transition.Child> |
| 47 |
</div> |
| 48 |
</Dialog> |
| 49 |
</Transition.Root> |
| 50 |
) |
| 51 |
} |
| 52 |
|