Fakultas Ilmu Komputer UI

Commit 3e93eae6 authored by Bagas's avatar Bagas
Browse files

fix code modal

parent 4e350475
Pipeline #26533 passed with stages
in 5 minutes and 27 seconds
......@@ -6,8 +6,9 @@ export default class ModalAlert extends React.Component {
super(props);
/* istanbul ignore next */
this.state = {
isOpen: false, header: '', content: '', callback: () => {},
open: false, header: '', content: '', callback: () => {},
};
this.open = this.open.bind(this);
this.close = this.close.bind(this);
}
......@@ -25,8 +26,18 @@ export default class ModalAlert extends React.Component {
if (anotherModal > 0) document.body.classList.add('scrolling', 'dimmable', 'dimmed');
};
open = (
header = this.state.header,
content = this.state.content,
callback = this.state.callback,
) => {
this.setState({
open: true, header, content, callback,
});
};
close = () => {
this.setState({ isOpen: false });
this.setState({ open: false });
this.state.callback();
};
......@@ -34,7 +45,7 @@ export default class ModalAlert extends React.Component {
const style = { whiteSpace: 'pre-wrap' };
return (
<ModalComponent
open={this.state.isOpen}
open={this.state.open}
icon={"warning sign"}
header={this.state.header}
style={style}
......
......@@ -6,8 +6,9 @@ export default class ModalSuccess extends React.Component {
super(props);
/* istanbul ignore next */
this.state = {
isOpen: false, header: '', content: '', callback: () => {},
open: false, header: '', content: '', callback: () => {},
};
this.open = this.open.bind(this);
this.close = this.close.bind(this);
}
......@@ -24,8 +25,17 @@ export default class ModalSuccess extends React.Component {
if (anotherModal > 0) document.body.classList.add('scrolling', 'dimmable', 'dimmed');
};
open = (header = this.state.header, content = this.state.content, callback = this.state.callback) => {
this.setState({
open: true,
header,
content,
callback,
});
};
close = () => {
this.setState({ isOpen: false });
this.setState({ open: false });
this.state.callback();
};
......@@ -33,7 +43,7 @@ export default class ModalSuccess extends React.Component {
const style = { whiteSpace: 'pre-wrap' };
return (
<ModalComponent
open={this.state.isOpen}
open={this.state.open}
icon={"checkmark sign"}
header={this.state.header}
style={style}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment