Skip to content

Commit

Permalink
Merge pull request #73 from miraisolutions/feature/69-single-box-curr…
Browse files Browse the repository at this point in the history
…ent-new

Merge the two boxes for current and new values into one.(#69)
  • Loading branch information
GuidoMaggio authored May 21, 2020
2 parents 083e4f9 + a71caa6 commit e360f8f
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 36 deletions.
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### Covid19 1.1.6.9000 (development version)

- Merge the two boxes for current and new values into one.(#69)
- fix trend order of area plot both global and country tabs, added utils funtion (#74)
- correct plot titles for modules mod_compare_nth_cases_plot and mod_growth_death_rate (#66)
- Add angle to bar-plot labels (#68)
Expand Down
57 changes: 22 additions & 35 deletions R/mod_caseBoxes.R
Original file line number Diff line number Diff line change
Expand Up @@ -38,60 +38,47 @@ mod_caseBoxes_ui <- function(id) {
mod_caseBoxes_server <- function(input, output, session, counts) {

output$confirmed <- renderUI({
countBox("Confirmed",
counts()[["confirmed"]],
color = "white",
background = case_colors[["confirmed"]])
})
output$new_confirmed <- renderUI({
countBox("New",
counts()[["new_confirmed"]],
countBox(title1 = "Confirmed: ",
subtitle1 = counts()[["confirmed"]],
title2 = "New: ",
subtitle2 = counts()[["new_confirmed"]],
color = "white",
background = case_colors[["confirmed"]])
})
output$death <- renderUI({
countBox("Deaths",
counts()[["deaths"]],
color = "white",
background = case_colors[["deaths"]])
})
output$new_death <- renderUI({
countBox("New",
counts()[["new_deaths"]],
countBox(title1 = "Deaths: ",
subtitle1 = counts()[["deaths"]],
title2 = "New: ",
subtitle2 = counts()[["new_deaths"]],
color = "white",
background = case_colors[["deaths"]])
})
output$recovered <- renderUI({
countBox("Recovered",
counts()[["recovered"]],
color = "white",
background = case_colors[["recovered"]])
})
output$new_recovered <- renderUI({
countBox("New",
counts()[["new_recovered"]],
countBox(title1 = "Recovered: ",
subtitle1 = counts()[["recovered"]],
title2 = "New: ",
subtitle2 = counts()[["new_recovered"]],
color = "white",
background = case_colors[["recovered"]])
})
output$active <- renderUI({
countBox("Active",
counts()[["active"]],
color = "white",
background = case_colors[["active"]])
})
output$new_active <- renderUI({
countBox("New",
counts()[["new_active"]],
countBox(title1 = "Active: ",
subtitle1 = counts()[["active"]],
title2 = "New: ",
subtitle2 = counts()[["new_active"]],
color = "white",
background = case_colors[["active"]])
})
}

countBox <- function(title, subtitle, color, background, width = "100%") {
countBox <- function(title1, subtitle1, title2, subtitle2, color, background, width = "100%") {
div(
class = "count-box",
shiny::h3(title),
shiny::p(formatC(subtitle, format = "f", big.mark = ",", digits = 0)),
shiny::h3(title1),
shiny::p(formatC(subtitle1, format = "f", big.mark = ",", digits = 0)),
br(),
shiny::h3(title2),
shiny::p(formatC(subtitle2, format = "f", big.mark = ",", digits = 0)),
style = sprintf(
"color: %s; background-color: %s; width: %s;",
color, background, width
Expand Down
4 changes: 3 additions & 1 deletion inst/app/www/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,10 @@ Count Boxes
.count-box h3 {
font-size: 28px;
color: inherit;
display: inline-block;
}

.count-box p {
font-size: 20px;
font-size: 23px;
display: inline-block;
}

0 comments on commit e360f8f

Please sign in to comment.