aboutsummaryrefslogtreecommitdiff
path: root/packages/aml-backoffice-ui/src/handlers/Dialog.tsx
blob: f9899e94e368e64ce86a2db1448ad1cc135403fe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
import { ComponentChildren, VNode, h } from "preact";

export function Dialog({ children, onClose }: { onClose?: () => void; children: ComponentChildren }): VNode {
  return <div class="relative z-10" aria-labelledby="modal-title" role="dialog" aria-modal="true" onClick={onClose}>
    <div class="fixed inset-0 bg-gray-500 bg-opacity-75 transition-opacity"></div>

    <div class="fixed inset-0 z-10 w-screen overflow-y-auto">
      <div class="flex min-h-full items-center justify-center p-4 text-center sm:items-center sm:p-0">
        <div class="relative transform overflow-hidden rounded-lg bg-white px-4 pb-4 pt-5 text-left shadow-xl transition-all sm:my-8 sm:w-full sm:max-w-sm sm:p-6">
          {children}
        </div>
      </div>
    </div>
  </div>
}