-
Notifications
You must be signed in to change notification settings - Fork 0
/
ui.js
25 lines (22 loc) · 1.04 KB
/
ui.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
class UI{
constructor(){
this.todaysStats = document.getElementById('todaysStats')
this.totalStats = document.getElementById('totalStats')
this.country = document.querySelector('h1')
this.lastUpdated = document.getElementById('lastUpdated')
}
setData(data) {
this.country.innerText = data.country
this.todaysStats.innerHTML = `
<li class="list-group-item"><strong>Cases: </strong>${data.dailyConfirmed}</li>
<li class="list-group-item"><strong>Deaths: </strong>${data.dailyDeaths}</li>
`
this.totalStats.innerHTML = `
<li class="list-group-item"><strong>Cases: </strong>${data.totalConfirmed}</li>
<li class="list-group-item"><strong>Recovered: </strong>${data.totalRecovered}</li>
<li class="list-group-item"><strong>Critical: </strong>${data.totalCritical}</li>
<li class="list-group-item"><strong>Deaths: </strong>${data.totalDeaths}</li>
`
this.lastUpdated.innerText = `Last Updated at ${data.lastUpdated}`
}
}