I'm building an app, and on one of the cards I've made I would like the text to be red if the number falls below zero.
This is reactive text and I was referencing like this
# ---- card-header
cardHeader <- function(title) {
h5(
title,
style = "color: #344a5e;"
)
}
# ---- card
Card <- function(title, content, size = "", style = "") {
div(class = glue("card ms-depth-4 ms-fontSize-16 ms-fontWeight-bold ms-sm-fontSize-16 ms-xl-fontSize-16"),
style = style,
Stack(
tokens = list(childrenGap = -5),
Text(variant = "xLarge", title, block = TRUE),
content
))
}
card3 <- Card(
tags$div(
gridPanel(
rows = "repeat(2 0.2fr)",
gridPanel(
rows = "1fr 0.10fr",
gap = "0px",
div(cardHeader("Total"))
)
)
),
div(class = 'figure',
textOutput("indig")
)
)
tried the following but error in dots_list(...)
card4 <- Card(
tags$div(
gridPanel(
rows = "repeat(2 0.2fr)",
gridPanel(
rows = "1fr 0.10fr",
gap = "0px",
div(cardHeader("Total"))
)
)
),
div(
if(textOutput("total_gen") > 0){
class = 'figure'
}
else {
class = 'figure_2'
}
)
)
How can I apply a conditional onto style here?