Skip to content

Commit

Permalink
Updates/fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cpsievert committed Oct 24, 2022
1 parent 0dab29a commit 30b29ab
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 15 deletions.
12 changes: 7 additions & 5 deletions R/card.R
Original file line number Diff line number Diff line change
Expand Up @@ -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()")
Expand Down Expand Up @@ -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)
}

Expand Down Expand Up @@ -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)
Expand Down
15 changes: 7 additions & 8 deletions R/files.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -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)
}
3 changes: 2 additions & 1 deletion R/layout.R
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
2 changes: 1 addition & 1 deletion man/value_box.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 30b29ab

Please sign in to comment.