-
-
Notifications
You must be signed in to change notification settings - Fork 677
/
App.js
78 lines (70 loc) 路 1.96 KB
/
App.js
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React, { Component } from "react";
import { ToastContainer, toast } from "react-toastify";
import Header from "./Header";
import BasicExample from "./BasicExample";
class App extends Component {
state = {
position: toast.POSITION.TOP_RIGHT,
delay: 5000,
type: "default",
autoClose: true,
hideProgressBar: false,
newestOnTop: false,
closeOnClick: true,
pauseOnHover: true
};
componentDidMount() {
toast("Default Notification !");
toast.success("Success Notification !", {
position: toast.POSITION.TOP_CENTER
});
toast.error("Error Notification !", {
position: toast.POSITION.TOP_LEFT
});
toast.warn("Warning Notification !", {
position: toast.POSITION.BOTTOM_LEFT
});
toast.info("Info Notification !", {
position: toast.POSITION.BOTTOM_CENTER
});
toast("Custom Style Notification !", {
position: toast.POSITION.BOTTOM_RIGHT,
className: 'dark-toast',
progressClassName: 'transparent-progress'
});
}
handleCheckBox = (checked, e) => {
this.setState({
[e.target.name]: !this.state[e.target.name]
});
};
setDelay = (value) => {
this.setState({ delay: value > 0 ? parseInt(value, 10) : 1});
}
handleRadio = (value, e) =>{
this.setState({
[e.target.name]: value
});
};
render() {
return (
<div className="App">
<Header />
<BasicExample
handleCheckBox={this.handleCheckBox}
handleRadio={this.handleRadio}
setDelay={this.setDelay}
{...this.state}/>
<ToastContainer
hideProgressBar={this.state.hideProgressBar}
newestOnTop={this.state.newestOnTop}
closeOnClick={this.state.closeOnClick}
autoClose={this.state.autoClose === false ? false : this.state.delay}
position={this.state.position}
pauseOnHover={this.state.pauseOnHover}
/>
</div>
);
}
}
export default App;