-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathComponent.jsx
More file actions
36 lines (32 loc) · 1.07 KB
/
Component.jsx
File metadata and controls
36 lines (32 loc) · 1.07 KB
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
// @ts-check
import React from 'react';
import Modal from './Modal.jsx';
export default class Component extends React.Component {
constructor(props) {
super(props);
this.state = { modal: false };
}
toggle = () => {
const { modal } = this.state;
this.setState({
modal: !modal,
});
};
render() {
const { modal } = this.state;
return (
<>
<button type="button" className="modal-open-button btn btn-danger" onClick={this.toggle}>Open</button>
<Modal isOpen={modal}>
<Modal.Header toggle={this.toggle}>Modal title</Modal.Header>
<Modal.Body>
Lorem ipsum dolor sit amet, consectetur adipisicing elit
</Modal.Body>
<Modal.Footer>
<button type="button" className="modal-close-button btn btn-secondary" onClick={this.toggle}>Cancel</button>
</Modal.Footer>
</Modal>
</>
);
}
}