Skip to content

Commit 98ae0f7

Browse files
committed
Follow up to #588: use named argument when supplying sidebar()
1 parent 5fd52c4 commit 98ae0f7

File tree

4 files changed

+23
-17
lines changed

4 files changed

+23
-17
lines changed

R/navs-legacy.R

+2-1
Original file line numberDiff line numberDiff line change
@@ -257,10 +257,11 @@ navbarPage_ <- function(title,
257257
# the .container-fluid class adds padding that we don't want)
258258
class = if (!fluid) "container",
259259
layout_sidebar(
260+
sidebar = sidebar,
260261
fillable = !isFALSE(fillable),
261262
border_radius = FALSE,
262263
border = !fluid,
263-
sidebar, contents
264+
contents
264265
)
265266
)
266267

R/navs.R

+6-1
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,12 @@ collect_nav_items <- function(..., wrapper) {
9595
navs_card_body <- function(content, sidebar) {
9696
content <- makeTabsFillable(content, fillable = TRUE)
9797
if (!is.null(sidebar)) {
98-
content <- layout_sidebar(sidebar, content, fillable = TRUE, border = FALSE)
98+
content <- layout_sidebar(
99+
sidebar = sidebar,
100+
fillable = TRUE,
101+
border = FALSE,
102+
content
103+
)
99104
}
100105
as.card_item(content)
101106
}

inst/themer-demo/R/tips.R

+10-10
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,16 @@ data(tips, package = "reshape2")
66

77
tipsUI <- function(id) {
88
ns <- NS(id)
9-
9+
1010
layout_sidebar(
1111
fillable = TRUE,
1212
sidebar = sidebar(
13-
title = "Restaurant tipping",
13+
title = "Restaurant tipping",
1414
sliderInput(
15-
ns("total_bill"),
16-
"Bill amount",
17-
min(tips$total_bill),
18-
max(tips$total_bill),
15+
ns("total_bill"),
16+
"Bill amount",
17+
min(tips$total_bill),
18+
max(tips$total_bill),
1919
value = range(tips$total_bill),
2020
pre = "$"
2121
),
@@ -51,8 +51,8 @@ tipsUI <- function(id) {
5151
card_header("Total bill vs tip"),
5252
layout_sidebar(
5353
fillable = TRUE,
54-
sidebar(
55-
position = "right",
54+
sidebar = sidebar(
55+
position = "right",
5656
open = FALSE,
5757
width = 150,
5858
selectInput(ns("scatter_color"), "Color by:", c("none", "sex", "smoker", "day", "time")),
@@ -72,7 +72,7 @@ tipsUI <- function(id) {
7272
card_header("Tip percentages"),
7373
layout_sidebar(
7474
fillable = TRUE,
75-
sidebar(
75+
sidebar = sidebar(
7676
position = "right",
7777
selectInput(ns("tip_perc_y"), "Split by:", c("sex", "smoker", "day", "time"), "day"),
7878
selectInput(ns("tip_perc_facet"), "Facet by:", c("none", "sex", "smoker", "day", "time"), "none"),
@@ -154,4 +154,4 @@ tipsServer <- function(id) {
154154
updateCheckboxGroupInput(session, "time", selected = c("Lunch", "Dinner"))
155155
})
156156
})
157-
}
157+
}

vignettes/sidebars.Rmd

+5-5
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ quakes_view <- card(
401401
full_screen = TRUE,
402402
card_header("Earthquake locations"),
403403
layout_sidebar(
404-
sidebar(map_filter),
404+
sidebar = sidebar(map_filter),
405405
map_quakes
406406
)
407407
)
@@ -620,7 +620,7 @@ card(
620620
card_header("Groups of diamond filters"),
621621
layout_sidebar(
622622
fillable = TRUE,
623-
sidebar(accordion_filters),
623+
sidebar = sidebar(accordion_filters),
624624
plots[[1]]
625625
)
626626
)
@@ -635,9 +635,9 @@ It's possible to nest sidebar layouts, which means you can effectively have any
635635
page_fillable(
636636
h1("Left and right sidebar", class = "px-3 my-3"),
637637
layout_sidebar(
638-
sidebar("Left sidebar"),
638+
sidebar = sidebar("Left sidebar"),
639639
layout_sidebar(
640-
sidebar("Right sidebar", position = "right", open = FALSE),
640+
sidebar = sidebar("Right sidebar", position = "right", open = FALSE),
641641
"Main contents",
642642
border = FALSE
643643
),
@@ -673,7 +673,7 @@ squake <- SharedData$new(quakes)
673673
674674
container <- layout_sidebar(
675675
class = "p-0",
676-
sidebar(
676+
sidebar = sidebar(
677677
title = "Earthquakes off Fiji",
678678
bg = "#1E1E1E",
679679
width = "35%",

0 commit comments

Comments
 (0)