forked from react-bootstrap/react-bootstrap
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAlertDismissable.js
More file actions
37 lines (32 loc) · 1011 Bytes
/
AlertDismissable.js
File metadata and controls
37 lines (32 loc) · 1011 Bytes
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
const AlertDismissable = React.createClass({
getInitialState() {
return {
alertVisible: true
};
},
render() {
if (this.state.alertVisible) {
return (
<Alert bsStyle="danger" onDismiss={this.handleAlertDismiss}>
<h4>Oh snap! You got an error!</h4>
<p>Change this and that and try again. Duis mollis, est non commodo luctus, nisi erat porttitor ligula, eget lacinia odio sem nec elit. Cras mattis consectetur purus sit amet fermentum.</p>
<p>
<Button bsStyle="danger">Take this action</Button>
<span> or </span>
<Button onClick={this.handleAlertDismiss}>Hide Alert</Button>
</p>
</Alert>
);
}
return (
<Button onClick={this.handleAlertShow}>Show Alert</Button>
);
},
handleAlertDismiss() {
this.setState({alertVisible: false});
},
handleAlertShow() {
this.setState({alertVisible: true});
}
});
ReactDOM.render(<AlertDismissable />, mountNode);