Skip to content

Commit

Permalink
fix: navset_card_pills/tabs/underline now properly uses header & foot…
Browse files Browse the repository at this point in the history
…er args (#1028)

* fix: navset_card_pills/tabs/underline uses header & footer args

* Update NEWS.md

* Update NEWS.md

* Add a note about the implicit card_body() added to header/footer

---------

Co-authored-by: Carson <cpsievert1@gmail.com>
  • Loading branch information
tanho63 and cpsievert authored Aug 19, 2024
1 parent b2ecc63 commit 556e932
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
2 changes: 2 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# bslib (development version)

* `navset_card_pills()`, `navset_card_underline()`, `navset_card_tabs()` fixed to now respect header/footer arguments (@tanho63, #1024)

# bslib 0.8.0

## Breaking changes
Expand Down
8 changes: 6 additions & 2 deletions R/navs-legacy.R
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,13 @@
#' @param selected a character string matching the `value` of a particular
#' [nav_panel()] item to selected by default.
#' @param header UI element(s) ([htmltools::tags]) to display _above_ the nav
#' content.
#' content. For `card`-based navsets, these elements are implicitly wrapped in
#' a `card_body()`. To control things like `padding`, `fill`, etc., wrap the
#' elements in an explicit [card_body()].
#' @param footer UI element(s) ([htmltools::tags]) to display _below_ the nav
#' content.
#' content. For `card`-based navsets, these elements are implicitly wrapped in
#' a `card_body()`. To control things like `padding`, `fill`, etc., wrap the
#' elements in an explicit [card_body()].
#'
#' @seealso [nav_panel()], [nav_panel_hidden()] create panels of content.
#' @seealso [nav_menu()], [nav_item()], [nav_spacer()] create menus, items, or
Expand Down
15 changes: 7 additions & 8 deletions R/navs.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,7 @@ navset_card_pill <- function(

items <- collect_nav_items(..., wrapper = wrapper)

pills <- navset_pill(
!!!items, id = id, selected = selected,
header = header, footer = footer
)
pills <- navset_pill(!!!items, id = id, selected = selected)

above <- match.arg(placement) == "above"

Expand All @@ -75,7 +72,9 @@ navset_card_pill <- function(
height = height,
full_screen = full_screen,
if (above) card_header(!!!nav_args),
header,
navs_card_body(content, sidebar),
footer,
if (!above) card_footer(!!!nav_args)
)
}
Expand Down Expand Up @@ -129,9 +128,7 @@ navset_card <- function(

items <- collect_nav_items(..., wrapper = wrapper)

tabs <- navset_func(
!!!items, id = id, selected = selected, header = header, footer = footer
)
tabs <- navset_func(!!!items, id = id, selected = selected)

tabQ <- tagQuery(tabs)

Expand All @@ -147,7 +144,9 @@ navset_card <- function(
} else {
card_header(nav)
},
navs_card_body(content, sidebar)
header,
navs_card_body(content, sidebar),
footer
)
}

Expand Down

0 comments on commit 556e932

Please sign in to comment.