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 / components / modals / SplitModal.js

SplitModal.js in Extendify 0.2.0, at src/components/modals/SplitModal.js

62 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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({
7 onClose,
8 isOpen,
9 invertedButtonColor,
10 children,
11 }) {
12 return (
13 <Transition.Root appear show={true} as={Fragment}>
14 <Dialog
15 as="div"
16 static
17 open={isOpen}
18 className="extendify"
19 onClose={onClose}>
20 <div className="fixed z-high inset-0 flex">
21 <Transition.Child
22 as={Fragment}
23 enter="ease-out duration-50 transition"
24 enterFrom="opacity-0"
25 enterTo="opacity-100">
26 <Dialog.Overlay className="fixed inset-0 bg-black bg-opacity-40 transition-opacity" />
27 </Transition.Child>
28 <Transition.Child
29 as={Fragment}
30 enter="ease-out duration-300 translate transform"
31 enterFrom="opacity-0 translate-y-4 sm:translate-y-5"
32 enterTo="opacity-100 translate-y-0">
33 <div className="m-auto">
34 <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">
35 <button
36 onClick={onClose}
37 className="absolute bg-transparent block p-4 top-0 right-0 rounded-md cursor-pointer text-gray-700 opacity-30 hover:opacity-100"
38 style={
39 invertedButtonColor && {
40 filter: 'invert(1)',
41 }
42 }>
43 <span className="sr-only">
44 {__('Close', 'extendify')}
45 </span>
46 <Icon icon={close} />
47 </button>
48 <div className="rounded-md md:rounded-l-md md:rounded-tr-none md:w-7/12">
49 {children[0]}
50 </div>
51 <div className="md:justify-none md:w-6/12 hidden md:block ">
52 {children[1]}
53 </div>
54 </div>
55 </div>
56 </Transition.Child>
57 </div>
58 </Dialog>
59 </Transition.Root>
60 )
61 }
62