Skip to content

Conversation

@gadenbuie
Copy link
Member

Closes #808

  • Re-organizes reference page using level-2 and level-3 headings, i.e. one level of abstraction above what we had before. We now have four top-level headings: Page Layouts, User Interface Layouts, Components, Theming, and Utility Functions.
  • Gives orienting descriptions to each of the sub-sections (level-3 groups).
  • page_navbar() and page_fillable() now have their own reference pages, separate from page().
  • We now consistently use @examplesIf rlang::is_interactive().
  • I updated the reference index styles with some small tweaks that improve the readability and help to separate the four topics.
Preview (screenshot)

Screenshot 2023-10-17 at 17-08-22 Function reference

@gadenbuie gadenbuie requested a review from cpsievert October 17, 2023 21:12
@gadenbuie gadenbuie changed the title docs(pkgdown): Soften template reference description docs(pkgdown): Re-organize and add descriptions to reference index Oct 17, 2023
Comment on lines +86 to +139
#' library(shiny)
#' library(ggplot2)
#'
#' ui <- page_fillable(
#' h1("Example", code("mtcars"), "dashboard"),
#' layout_columns(
#' card(
#' full_screen = TRUE,
#' card_header("Number of forward gears"),
#' plotOutput("gear")
#' ),
#' card(
#' full_screen = TRUE,
#' card_header("Number of carburetors"),
#' plotOutput("carb")
#' )
#' ),
#' card(
#' full_screen = TRUE,
#' card_header("Weight vs. Quarter Mile Time"),
#' layout_sidebar(
#' sidebar = sidebar(
#' varSelectInput("var_x", "Compare to qsec:", mtcars[-7], "wt"),
#' varSelectInput("color", "Color by:", mtcars[-7], "cyl"),
#' position = "right"
#' ),
#' plotOutput("var_vs_qsec")
#' )
#' )
#' )
#'
#' server <- function(input, output) {
#' for (var in c("cyl", "vs", "am", "gear", "carb")) {
#' mtcars[[var]] <- as.factor(mtcars[[var]])
#' }
#'
#' output$gear <- renderPlot({
#' ggplot(mtcars, aes(gear)) + geom_bar()
#' })
#'
#' output$carb <- renderPlot({
#' ggplot(mtcars, aes(carb)) + geom_bar()
#' })
#'
#' output$var_vs_qsec <- renderPlot({
#' req(input$var_x, input$color)
#'
#' ggplot(mtcars) +
#' aes(y = qsec, x = !!input$var_x, color = !!input$color) +
#' geom_point()
#' })
#' }
#'
#' shinyApp(ui, server)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Maybe once shiny::runExample() gets an extension point this would be a good candidate for an example?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks and yeah, good idea!

Copy link
Collaborator

@cpsievert cpsievert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicely done, thanks! Feel free to merge once the last few comments are addressed

@gadenbuie gadenbuie merged commit 212d1f7 into main Oct 18, 2023
@gadenbuie gadenbuie deleted the docs/reference-page-reorg branch October 18, 2023 17:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Revisit/update page reference docs

3 participants