From ba5a01d135573e4008d9778c2a3dfa6db06fc3b3 Mon Sep 17 00:00:00 2001 From: m7pr Date: Tue, 5 Mar 2024 15:47:42 +0100 Subject: [PATCH] standard_layout --- R/standard_layout.R | 35 +++++++++++++++++++++++++++++++---- man/standard_layout.Rd | 36 ++++++++++++++++++++++++++++++++---- 2 files changed, 63 insertions(+), 8 deletions(-) diff --git a/R/standard_layout.R b/R/standard_layout.R index cd004e96..d1c381e8 100644 --- a/R/standard_layout.R +++ b/R/standard_layout.R @@ -1,8 +1,8 @@ -#' Create a standard UI layout with output on the right and an encoding panel on -#' the left +#' Standard UI layout #' -#' @description `r lifecycle::badge("stable")` -#' This is the layout used by the `teal` modules. +#' @description `r lifecycle::badge("stable")`\cr +#' Create a standard UI layout with output on the right and an encoding panel on +#' the left. This is the layout used by the `teal` modules. #' #' @param output (`shiny.tag`)\cr #' object with the output element (table, plot, listing) such as for example returned @@ -19,6 +19,33 @@ #' #' @return an object of class \code{shiny.tag} with the UI code. #' +#' @examples +#' library(shiny) +#' standard_layout( +#' output = white_small_well(h3("Tests")), +#' encoding = div( +#' teal.reporter::simple_reporter_ui("simple_reporter"), +#' tags$label("Encodings", class = "text-primary"), +#' panel_item( +#' "Tests", +#' optionalSelectInput( +#' "tests", +#' "Tests:", +#' choices = c( +#' "Shapiro-Wilk", +#' "Kolmogorov-Smirnov (one-sample)" +#' ), +#' selected = "Shapiro-Wilk" +#' ) +#' ) +#' ), +#' forms = tagList( +#' verbatim_popup_ui("warning", "Show Warnings"), +#' verbatim_popup_ui("rcode", "Show R code") +#' ) +#' ) +#' +#' #' @export standard_layout <- function(output, encoding = NULL, diff --git a/man/standard_layout.Rd b/man/standard_layout.Rd index 33f8437a..336312fa 100644 --- a/man/standard_layout.Rd +++ b/man/standard_layout.Rd @@ -2,8 +2,7 @@ % Please edit documentation in R/standard_layout.R \name{standard_layout} \alias{standard_layout} -\title{Create a standard UI layout with output on the right and an encoding panel on -the left} +\title{Standard UI layout} \usage{ standard_layout( output, @@ -35,6 +34,35 @@ into context. For example the \code{\link[shiny:helpText]{shiny::helpText()}} el an object of class \code{shiny.tag} with the UI code. } \description{ -\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}} -This is the layout used by the \code{teal} modules. +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#stable}{\figure{lifecycle-stable.svg}{options: alt='[Stable]'}}}{\strong{[Stable]}}\cr +Create a standard UI layout with output on the right and an encoding panel on +the left. This is the layout used by the \code{teal} modules. +} +\examples{ +library(shiny) +standard_layout( + output = white_small_well(h3("Tests")), + encoding = div( + teal.reporter::simple_reporter_ui("simple_reporter"), + tags$label("Encodings", class = "text-primary"), + panel_item( + "Tests", + optionalSelectInput( + "tests", + "Tests:", + choices = c( + "Shapiro-Wilk", + "Kolmogorov-Smirnov (one-sample)" + ), + selected = "Shapiro-Wilk" + ) + ) + ), + forms = tagList( + verbatim_popup_ui("warning", "Show Warnings"), + verbatim_popup_ui("rcode", "Show R code") + ) +) + + }