import React, {useState} from "react";
import {
Box,
Button,
Dialog as MuiDialog,
DialogActions,
DialogContent,
DialogContentText,
DialogTitle,
Input, TextField
} from "@mui/material";
export default function Dialog(props) {
const show = props.show;
const onClose = props.onClose || function() { };
const onOption = props.onOption || function() { };
const options = props.options || ["Close"];
const inputs = props.inputs || [];
const [inputData, setInputData] = useState({});
let buttons = [];
for (const [index, name] of options.entries()) {
buttons.push(
)
}
let inputElements = [];
for (const input of inputs) {
let inputProps = { ...input };
delete inputProps.name;
delete inputProps.type;
switch (input.type) {
case 'text':
inputElements.push( setInputData({ ...inputData, [input.name]: e.target.value })}
/>)
break;
}
}
return
{ props.title }
{ props.message }
{ inputElements }
{ buttons }
}