import React from "react" ; import Dialog from "@material-ui/core/Dialog" ; import DialogTitle from "@material-ui/core/DialogTitle" ; import DialogContent from "@material-ui/core/DialogContent" ; import DialogActions from "@material-ui/core/DialogActions" ; import Button from "@material-ui/core/Button" ; import "./ModalForm.css" ; import { slugify } from "./utils" ; // -------------------------------------------------------------------- export default class ModalForm extends React.Component { render() { // initialize the buttons let buttons = [] ; for ( let btn in this.props.buttons ) { buttons.push( ) ; } // show the dialog return ( {this.props.title} { typeof this.props.content === "function" ? this.props.content() : this.props.content } {buttons} ) ; } onClose() { // close the dialog if ( this.props.buttons.Cancel ) this.props.buttons.Cancel() ; else if ( this.props.buttons.Close ) this.props.buttons.Close() ; } }