Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | import React, { Component, MouseEventHandler } from "react";
import "./ModalView.css";
export class ModalViewProps {
key: string;
title: string;
description: string;
icon: string;
handleClose: MouseEventHandler;
show: boolean;
constructor(
key: string,
title: string,
description: string,
icon: string,
handleClose: MouseEventHandler = () => ({}),
show: boolean
) {
this.key = key;
this.title = title;
this.description = description;
this.icon = icon;
this.handleClose = handleClose;
this.show = show;
}
}
export const ModalView: React.FC<ModalViewProps> = (props, children) => {
const showHideClassName = props.show
? "modal display-block"
: "modal display-none";
return (
<div className={showHideClassName}>
<section className="modal-main">
<h1>
{props.icon} {props.title}
</h1>
<p>{props.description}</p>
{children}
<button type="button" onClick={props.handleClose}>
Close
</button>
</section>
</div>
);
};
|