-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
75 lines (69 loc) · 1.55 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
import React, { useState } from 'react';
import 'devextreme/dist/css/dx.light.css';
import { Button } from 'devextreme-react/button';
import { Toast, Position } from 'devextreme-react/toast';
import notify from 'devextreme/ui/notify';
const types = ['error', 'info', 'success', 'warning'];
const showMessage = () => {
notify(
{
message: "You have a new message",
width: 230,
position: {
at: "bottom",
my: "bottom",
of: "#container"
}
},
types[Math.floor(Math.random() * 4)],
500
);
}
function App() {
const [isVisible, setIsVisible] = useState(false);
const showCustomMessage = () => {
setIsVisible(true);
}
const onHiding = () => {
setIsVisible(false);
}
const contentRender = () => {
return (
<div class="flex-box">
<span>You have a new message </span>
<i class='dx-icon-email icon-style'></i>
</div>
);
}
return (
<div id="container">
<div id="buttons">
<Button
text="Show message"
onClick={showMessage}
>
</Button>
<Button
text="Show custom message"
onClick={showCustomMessage}
>
</Button>
</div>
<Toast
visible={isVisible}
width={230}
height={50}
type="custom"
contentRender={contentRender}
onHiding={onHiding}
>
<Position
my="bottom"
at="bottom"
of="#container"
/>
</Toast>
</div>
);
}
export default App;