-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
141 lines (118 loc) · 3.27 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
<!DOCTYPE html>
<html lang="pt-br">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Desafio Redux</title>
<script src="./immer.umd.production.min.js"></script>
<script src="./redux.min.js"></script>
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link crossorigin="anonymous" href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;700&display=swap" rel="stylesheet">
<style>
* {
padding: 0px;
margin: 0px;
box-sizing: border-box;
font-family: 'Roboto', sans-serif;
}
main {
width: 100%;
height: 100vh;
display: flex;
justify-content: center;
align-items: center;
background-color: #2E8BC0;
}
.card {
width: 95%;
max-width: 320px;
background-color: #0C2D48;
border-radius: 10px;
color: #0C2D48;
box-shadow: rgba(0, 0, 0, 0.35) 0px 5px 15px;
padding: 20px;
}
.card div {
display: flex;
flex-wrap: wrap;
justify-content: space-between;
}
.card h1 {
color: #B1D4E0;
margin-bottom: 20px;
}
.card p {
width: 48%;
height: 100px;
display: flex;
flex-direction: column-reverse;
align-items: center;
background-color: #B1D4E0;
border-radius: 10px;
font-weight: bold;
justify-content: center;
font-size: 14px;
margin-bottom: 20px;
}
.card p:first-of-type {
width: 100%;
}
.card p span {
display: block;
margin: 5px 20px;
font-size: 30px;
}
.card p:first-of-type span {
font-size: 23px;
}
</style>
</head>
<body>
<main>
<div class="card">
<div>
<h1 id="nome">Nome</h1>
<p>
E-mail
<span id="email"></span>
</p>
<p>
Dias restantes
<span id="tempo"></span>
</p>
<p>
Aulas completas
<span id="aulasCompletas"></span>
</p>
</div>
</div>
</main>
<script type="module">
import store from './store/storeConfigure.js';
import { incrementarTempo, reduzirTempo, modificarEmail } from './store/modules/aluno.js';
import { completarAula, completarCurso, resetarCurso } from './store/modules/aulas.js';
const render = () => {
const { aluno, aulas } = store.getState();
const nomeEl = document.getElementById('nome');
const emailEl = document.getElementById('email');
const tempoEl = document.getElementById('tempo');
const aulasEl = document.getElementById('aulasCompletas');
const aulasCompletas = aulas.filter(element => element.completa).length;
nomeEl.innerHTML = aluno.nome;
emailEl.innerHTML = aluno.email;
tempoEl.innerHTML = aluno.diasRestantes;
aulasEl.innerHTML = aulasCompletas;
}
render();
store.subscribe(render);
store.dispatch(incrementarTempo());
store.dispatch(reduzirTempo());
store.dispatch(modificarEmail('lucas@gmail.com'));
store.dispatch(completarAula(2));
store.dispatch(completarCurso());
store.dispatch(resetarCurso());
</script>
</body>
</html>