added modal footer

This commit is contained in:
Florian Scholdei
2019-02-07 13:53:15 +01:00
parent b3a3162d34
commit 9fae4c7d46
3 changed files with 40 additions and 32 deletions

View File

@@ -7,6 +7,7 @@ type Props = {
title: string,
closeFunction: () => void,
body: any,
footer?: any,
active: boolean,
classes: any
};
@@ -19,42 +20,35 @@ const styles = {
}
};
class Modal extends React.Component<Props> {
render() {
const { title, closeFunction, body, active, classes } = this.props;
const { title, closeFunction, body, footer, active, classes } = this.props;
const isActive = active ? "is-active" : null;
let showFooter = null;
if (footer) {
showFooter = <footer className="modal-card-foot">{footer}</footer>;
}
return (
<div className={classNames(
"modal",
isActive
)}>
<div className={classNames("modal", isActive)}>
<div className="modal-background" />
<div className={classNames("modal-card", classes.resize)}>
<header className="modal-card-head">
<p className="modal-card-title">
{title}
</p>
<p className="modal-card-title">{title}</p>
<button
className="delete"
aria-label="close"
onClick={closeFunction}
/>
</header>
<section className="modal-card-body">
{body}
</section>
<section className="modal-card-body">{body}</section>
{showFooter}
</div>
</div>
);
}
}
export default injectSheet(styles)(Modal);