-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcustom_box.R
50 lines (40 loc) · 1.43 KB
/
custom_box.R
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
valueBoxSpark <- function(value, subtitle, description, minititle = NULL,
icon = NULL, color = "aqua",
idPlot, infoID, serieBtn, var_tiempo= "último mes") {
#creo icono de info con id
info_icon <- tags$small(
actionButton(inputId = infoID, icon = icon("info-circle"), label = NULL, style = "background-color: transparent; color: white; border-color: transparent;"),
class = "pull-right"
)
serie_icon <- tags$small(
prettyToggle(
inputId = serieBtn,
label_on = "Ver serie completa",
icon_on = icon("chart-line"),
status_on = "success",
status_off = "success",
label_off = paste0("Ver ",var_tiempo),
icon_off = icon("chart-simple"),
outline = TRUE,
value = FALSE,
plain = TRUE
),
style = "background-color: transparent !important"
)
#creo caja con todos los elementos
boxContent <- div(
class = paste0("small-box bg-", color),
div(
class = "inner",
if (!is.null(icon)) div(class = "icon-large", icon, style = "bottom: unset !important;"),
if(!is.null(minititle)) h4(minititle),#tags$small(minititle, style = "color: white;"),
h3(value),
if (!is.null(description)) h5(description),
plotlyOutput(idPlot, width = "auto", height = 100) %>% withSpinner(color = "white"),
serie_icon,
info_icon,
h4(subtitle)
)
)
div(boxContent)
}