diff --git a/R/card.R b/R/card.R index c3f0e439b..9eb0737f2 100644 --- a/R/card.R +++ b/R/card.R @@ -65,7 +65,8 @@ card <- function(..., full_screen = FALSE, height = NULL, class = NULL, wrapper if (full_screen) full_screen_toggle() ) - tag <- asFillContainer(tag, class = class, height = height, asItem = TRUE) + tag <- asFillContainer(tag, height = height, asItem = TRUE) + tag <- tagAppendAttributes(tag, class = class) as_fragment( tag_require(tag, version = 5, caller = "card()") @@ -173,11 +174,11 @@ card_body_ <- function(..., fill = TRUE, height = NULL, class = NULL, container ) if (fill) { - tag <- asFillContainer(tag, class = class, asItem = TRUE) - } else { - tag <- tagAppendAttributes(tag, class = class) + tag <- asFillContainer(tag, asItem = TRUE) } + tag <- tagAppendAttributes(tag, class = class) + as.card_item(tag) } @@ -233,7 +234,8 @@ card_image <- function( ... ) - image <- asFillItem(image, class = class, height = height, width = width) + image <- asFillItem(image, height = height, width = width) + image <- tagAppendAttributes(image, class = class) if (!is.null(href)) { image <- asFillContainer(tags$a(href = href, image), asItem = TRUE) diff --git a/R/files.R b/R/files.R index b7c13d46b..a63d7bbf3 100644 --- a/R/files.R +++ b/R/files.R @@ -46,6 +46,7 @@ bootswatch_sass_file <- function(theme, file, version = version_default()) { # Given a vector of sass_file()s, create a list of sass_bundles(), # so each rule may be removed layer (by it's files basename) rule_bundles <- function(files) { + files <- lapply(files, as_sass_file) paths <- vapply(files, get_sass_file_path, character(1)) nms <- tools::file_path_sans_ext(basename(paths)) Map( @@ -57,14 +58,12 @@ rule_bundles <- function(files) { } get_sass_file_path <- function(x) { - if (!inherits(x, "sass_file")) { - x <- sass_file(x) - } - path <- attr(x, "sass_file_path") - if (length(path) == 0) { - stop("Couldn't find file path") - } + if (length(path)) return(path) + + stop("Couldn't find file path") +} - path +as_sass_file <- function(x) { + if (inherits(x, "sass_file")) x else sass_file(x) } diff --git a/R/layout.R b/R/layout.R index 081e98a02..085c6a024 100644 --- a/R/layout.R +++ b/R/layout.R @@ -96,7 +96,8 @@ layout_column_wrap <- function( children ) - tag <- asFillItem(tag, class = class) + tag <- asFillItem(tag) + tag <- tagAppendAttributes(tag, class = class) tag <- as.card_item(tag) as_fragment( diff --git a/inst/examples/card/app.R b/inst/examples/card/app.R index 666baeb9c..8e2116354 100644 --- a/inst/examples/card/app.R +++ b/inst/examples/card/app.R @@ -73,9 +73,9 @@ main_grid <- layout_column_wrap( card( full_screen = TRUE, card_header("Scrollable gt()"), - card_body( - id = "gt_container", - height = "100%", + card_body_fill( + max_height = "400px", + max_height_full_screen = "100%", gt::gt(mtcars) ) ) @@ -112,12 +112,8 @@ server <- function(input, output, session) { observeEvent(input$fixed_height, ignoreInit = TRUE, { css <- sprintf( - " - #grid_page { height: %s !important; } - #gt_container { height: %s !important; } - ", - if (input$fixed_height) grid_height else "auto", - if (input$fixed_height) "100%" else "400px" + "#grid_page { height: %s !important; }", + if (input$fixed_height) grid_height else "auto" ) insertUI(selector = "head", ui = tags$style(HTML(css))) diff --git a/man/value_box.Rd b/man/value_box.Rd index 6d3cf772c..b6e259e05 100644 --- a/man/value_box.Rd +++ b/man/value_box.Rd @@ -39,7 +39,7 @@ display below \code{value}.. Named arguments become attributes on the containing element.} \item{showcase}{a \code{\link[htmltools:builder]{htmltools::tag()}} child to showcase (e.g., a -\code{\link[bsicons:bs_icon]{bsicons::bs_icon()}}, a \code{\link[plotly:plotlyOutput]{plotly::plotlyOutput()}}, etc).} +\code{\link[bsicons:bs_icon]{bsicons::bs_icon()}}, a \code{\link[plotly:plotly-shiny]{plotly::plotlyOutput()}}, etc).} \item{showcase_layout}{either \code{showcase_left_center()} or \code{showcase_top_right()}.}