fantasy-manager/components/Dialog.tsx
Lukas Schaefer 5c7526af08
Fix types for react 19
Signed-off-by: Lukas Schaefer <lukas@lschaefer.xyz>
2025-06-07 14:10:16 -04:00

34 lines
874 B
TypeScript

import { Dialog, DialogTitle, Icon, IconButton } from "@mui/material";
import { MouseEventHandler, ReactNode } from "react";
interface Props {
children: ReactNode;
onClose: MouseEventHandler;
title: string;
open: boolean;
}
// A simple dialog
export default function Home({ children, onClose, title, open }: Props) {
return (
<Dialog open={open} scroll="body">
<DialogTitle sx={{ m: 0, p: 2 }}>
{title}
{onClose ? (
<IconButton
id="close"
aria-label="close"
onClick={onClose}
sx={{
position: "absolute",
right: 8,
top: 8,
color: (theme) => theme.palette.grey[500],
}}
>
<Icon>close</Icon>
</IconButton>
) : null}
</DialogTitle>
{children}
</Dialog>
);
}