mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-29 09:30:59 +00:00
chore: fmt
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { ReactNode, useEffect } from 'react';
|
||||
import { ReactNode, useEffect } from "react";
|
||||
|
||||
export interface ModalProps {
|
||||
open: boolean;
|
||||
@@ -12,10 +12,10 @@ const Modal = ({ open, title, onClose, children, footer }: ModalProps) => {
|
||||
useEffect(() => {
|
||||
if (!open) return;
|
||||
const onKey = (event: KeyboardEvent) => {
|
||||
if (event.key === 'Escape') onClose();
|
||||
if (event.key === "Escape") onClose();
|
||||
};
|
||||
window.addEventListener('keydown', onKey);
|
||||
return () => window.removeEventListener('keydown', onKey);
|
||||
window.addEventListener("keydown", onKey);
|
||||
return () => window.removeEventListener("keydown", onKey);
|
||||
}, [open, onClose]);
|
||||
|
||||
if (!open) return null;
|
||||
@@ -38,7 +38,9 @@ const Modal = ({ open, title, onClose, children, footer }: ModalProps) => {
|
||||
) : null}
|
||||
<div className="px-4 py-4 text-sm text-gray-700">{children}</div>
|
||||
{footer ? (
|
||||
<div className="flex justify-end gap-2 border-t border-gray-200 px-4 py-3">{footer}</div>
|
||||
<div className="flex justify-end gap-2 border-t border-gray-200 px-4 py-3">
|
||||
{footer}
|
||||
</div>
|
||||
) : null}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
export { default } from './Modal';
|
||||
export type { ModalProps } from './Modal';
|
||||
export { default } from "./Modal";
|
||||
export type { ModalProps } from "./Modal";
|
||||
|
||||
Reference in New Issue
Block a user