-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
111 lines (97 loc) · 3.12 KB
/
index.html
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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Snackbar</title>
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" href="dist/css/reset.css">
<link rel="stylesheet" href="dist/css/component.css">
<link href="https://fonts.googleapis.com/css?family=Montserrat&display=swap" rel="stylesheet">
<style>
body{
font-family: 'Montserrat', sans-serif;
}
.wrapper{
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
flex-flow: column;
}
button{
outline: none;
background: #34495e;
color: white;
border: none;
padding: 1rem 1.25rem;
border-radius: 5px;
font-weight: bold;
}
button:hover{
cursor: pointer;
}
button:active{
transform: scale(0.992);
}
.credits{
margin-top: 1rem;
text-align: center;
}
</style>
</head>
<body>
<div class="wrapper">
<h1>Snackbar</h1>
<div>
<button type="button" onclick="showDemo(1)">Show</button>
<button type="button" onclick="showDemo(2)">Hide</button>
<button type="button" onclick="showDemo(3)">Show with time</button>
<button type="button" onclick="showDemo(4)">Show with time and button</button>
<button type="button" onclick="showDemo(5)">Big text</button>
</div>
<div class="credits">
<p>Made by: Diogo Souza Machado</p>
<p>Under <a href="https://diogo-souzamachado.mit-license.org/" target="_blank">MIT</a></p>
</div>
</div>
<div class="snackbar">
<p></p>
</div>
<script src="dist/snackbar.js"></script>
<script>
// This code is only test
function showDemo(key){
switch (key) {
case 1:
snackbar.show("Hello World");
break;
case 2:
snackbar.hide();
break;
case 3:
snackbar.timer("Hello World with 5 seconds", 5000);
break;
case 4:
// Create new button
var button = {};
button.id = "btn_cancel";
button.title = "Cancel";
// Set function callback
snackbar.setCallback(test);
// Call
snackbar.timer("Hello World", 12000, button);
break;
case 5:
snackbar.timer("Hello World with big text lorem ipsum and survive", 5000);
break;
default:
break;
}
}
// Example function callback
function test(){
alert("Ok, execute a function");
}
</script>
</body>
</html>