Skip to content

Commit f12a85b

Browse files
committed
Updates/fixes
1 parent 0dab29a commit f12a85b

File tree

5 files changed

+22
-24
lines changed

5 files changed

+22
-24
lines changed

R/card.R

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,8 @@ card <- function(..., full_screen = FALSE, height = NULL, class = NULL, wrapper
6565
if (full_screen) full_screen_toggle()
6666
)
6767

68-
tag <- asFillContainer(tag, class = class, height = height, asItem = TRUE)
68+
tag <- asFillContainer(tag, height = height, asItem = TRUE)
69+
tag <- tagAppendAttributes(tag, class = class)
6970

7071
as_fragment(
7172
tag_require(tag, version = 5, caller = "card()")
@@ -173,11 +174,11 @@ card_body_ <- function(..., fill = TRUE, height = NULL, class = NULL, container
173174
)
174175

175176
if (fill) {
176-
tag <- asFillContainer(tag, class = class, asItem = TRUE)
177-
} else {
178-
tag <- tagAppendAttributes(tag, class = class)
177+
tag <- asFillContainer(tag, asItem = TRUE)
179178
}
180179

180+
tag <- tagAppendAttributes(tag, class = class)
181+
181182
as.card_item(tag)
182183
}
183184

@@ -233,7 +234,8 @@ card_image <- function(
233234
...
234235
)
235236

236-
image <- asFillItem(image, class = class, height = height, width = width)
237+
image <- asFillItem(image, height = height, width = width)
238+
image <- tagAppendAttributes(image, class = class)
237239

238240
if (!is.null(href)) {
239241
image <- asFillContainer(tags$a(href = href, image), asItem = TRUE)

R/files.R

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ bootswatch_sass_file <- function(theme, file, version = version_default()) {
4646
# Given a vector of sass_file()s, create a list of sass_bundles(),
4747
# so each rule may be removed layer (by it's files basename)
4848
rule_bundles <- function(files) {
49+
files <- lapply(files, as_sass_file)
4950
paths <- vapply(files, get_sass_file_path, character(1))
5051
nms <- tools::file_path_sans_ext(basename(paths))
5152
Map(
@@ -57,14 +58,12 @@ rule_bundles <- function(files) {
5758
}
5859

5960
get_sass_file_path <- function(x) {
60-
if (!inherits(x, "sass_file")) {
61-
x <- sass_file(x)
62-
}
63-
6461
path <- attr(x, "sass_file_path")
65-
if (length(path) == 0) {
66-
stop("Couldn't find file path")
67-
}
62+
if (length(path)) return(path)
63+
64+
stop("Couldn't find file path")
65+
}
6866

69-
path
67+
as_sass_file <- function(x) {
68+
if (inherits(x, "sass_file")) x else sass_file(x)
7069
}

R/layout.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ layout_column_wrap <- function(
9696
children
9797
)
9898

99-
tag <- asFillItem(tag, class = class)
99+
tag <- asFillItem(tag)
100+
tag <- tagAppendAttributes(tag, class = class)
100101
tag <- as.card_item(tag)
101102

102103
as_fragment(

inst/examples/card/app.R

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ main_grid <- layout_column_wrap(
7373
card(
7474
full_screen = TRUE,
7575
card_header("Scrollable gt()"),
76-
card_body(
77-
id = "gt_container",
78-
height = "100%",
76+
card_body_fill(
77+
max_height = "400px",
78+
max_height_full_screen = "100%",
7979
gt::gt(mtcars)
8080
)
8181
)
@@ -112,12 +112,8 @@ server <- function(input, output, session) {
112112

113113
observeEvent(input$fixed_height, ignoreInit = TRUE, {
114114
css <- sprintf(
115-
"
116-
#grid_page { height: %s !important; }
117-
#gt_container { height: %s !important; }
118-
",
119-
if (input$fixed_height) grid_height else "auto",
120-
if (input$fixed_height) "100%" else "400px"
115+
"#grid_page { height: %s !important; }",
116+
if (input$fixed_height) grid_height else "auto"
121117
)
122118

123119
insertUI(selector = "head", ui = tags$style(HTML(css)))

man/value_box.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)