Skip to content

Commit

Permalink
fix(navbar): Validate gap and padding early (#991)
Browse files Browse the repository at this point in the history
  • Loading branch information
gadenbuie authored Feb 27, 2024
1 parent de30e53 commit 243499a
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@

* `uiOutput()` no longer yields unwanted double padding when it's parent container uses `gap` for spacing multiple elements (e.g., `layout_columns()`, `page_fillable()`, etc). (#992)

* `page_navbar()` and `navset_bar()` now validate and transform `padding` and `gap` arguments into appropriate CSS values. (#991)

# bslib 0.6.1

## Bug fixes
Expand Down
3 changes: 3 additions & 0 deletions R/navs-legacy.R
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ navset_bar <- function(..., title = NULL, id = NULL, selected = NULL,
header = NULL, footer = NULL,
bg = NULL, inverse = "auto",
collapsible = TRUE, fluid = TRUE) {
padding <- validateCssPadding(padding)
gap <- validateCssUnit(gap)

navs_bar_(
..., title = title, id = id, selected = selected,
sidebar = sidebar, fillable = fillable,
Expand Down
4 changes: 4 additions & 0 deletions R/page.R
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ page_fillable <- function(
}

validateCssPadding <- function(padding = NULL) {
if (is.null(padding)) return(NULL)
paste(
vapply(padding, validateCssUnit, character(1)),
collapse = " "
Expand Down Expand Up @@ -386,6 +387,9 @@ page_navbar <- function(

sidebar <- maybe_page_sidebar(sidebar)

padding <- validateCssPadding(padding)
gap <- validateCssUnit(gap)

# Default to fillable = F when this is called from shiny::navbarPage()
# TODO: update shiny::navbarPage() to set fillable = FALSE and get rid of this hack
if (missing(fillable)) {
Expand Down
Binary file not shown.
Binary file modified inst/fonts/KFOlCnqEu92Fr1MmWUlfBBc-.woff
Binary file not shown.
Binary file modified inst/fonts/QGYpz_kZZAGCONcK2A4bGOj8mNhL.woff
Binary file not shown.

0 comments on commit 243499a

Please sign in to comment.