Skip to content

Commit

Permalink
tiny update: f7Toggle example
Browse files Browse the repository at this point in the history
  • Loading branch information
DivadNojnarg committed Mar 23, 2024
1 parent c604221 commit 355a94c
Show file tree
Hide file tree
Showing 4 changed files with 66 additions and 141 deletions.
40 changes: 1 addition & 39 deletions R/f7-inputs.R
Original file line number Diff line number Diff line change
Expand Up @@ -2320,38 +2320,6 @@ updateF7Stepper <- function(inputId, min = NULL, max = NULL,
#' "teal, "lime", "deeporange", "gray", "white", "black".
#'
#' @rdname toggle
#' @examples
#' # f7Toggle
#' if (interactive()) {
#' library(shiny)
#' library(shinyMobile)
#'
#' shinyApp(
#' ui = f7Page(
#' title = "My app",
#' f7SingleLayout(
#' navbar = f7Navbar(title = "f7Toggle"),
#' f7Toggle(
#' inputId = "toggle",
#' label = "My toggle",
#' color = "pink",
#' checked = TRUE
#' ),
#' verbatimTextOutput("test"),
#' f7Toggle(
#' inputId = "toggle2",
#' label = "My toggle 2"
#' ),
#' verbatimTextOutput("test2")
#' )
#' ),
#' server = function(input, output) {
#' output$test <- renderPrint(input$toggle)
#' output$test2 <- renderPrint(input$toggle2)
#' }
#' )
#' }
#' #
#' @export
f7Toggle <- function(inputId, label, checked = FALSE, color = NULL) {
toggleCl <- "toggle"
Expand All @@ -2378,12 +2346,6 @@ f7Toggle <- function(inputId, label, checked = FALSE, color = NULL) {
#'
#' \code{updateF7Toggle} changes the value of a toggle input on the client.
#'
#' @param inputId The id of the input object.
#' @param checked Whether the toggle is TRUE or FALSE.
#' @param color
#' Toggle color: NULL or "primary", "red", "green", "blue",
#' "pink", "yellow", "orange", "purple", "deeppurple", "lightblue",
#' "teal, "lime", "deeporange", "gray", "white", "black".
#' @param session The Shiny session object.
#'
#' @export
Expand Down Expand Up @@ -2420,7 +2382,7 @@ f7Toggle <- function(inputId, label, checked = FALSE, color = NULL) {
#' observeEvent(input$update, {
#' updateF7Toggle(
#' inputId = "toggle",
#' checked = TRUE,
#' checked = !input$toggle,
#' color = "green"
#' )
#' })
Expand Down
68 changes: 32 additions & 36 deletions R/f7Skeleton.R
Original file line number Diff line number Diff line change
Expand Up @@ -16,53 +16,49 @@
#'
#' @examples
#' if (interactive()) {
#' library(shiny)
#' library(shinyMobile)
#' library(shiny)
#' library(shinyMobile)
#'
#' shinyApp(
#' ui = f7Page(
#' title = "Skeletons",
#' f7SingleLayout(
#' navbar = f7Navbar(title = "f7Skeleton"),
#' f7Card(
#' title = "Card header",
#' "This is a simple card with plain text,
#' shinyApp(
#' ui = f7Page(
#' title = "Skeletons",
#' f7SingleLayout(
#' navbar = f7Navbar(title = "f7Skeleton"),
#' f7Card(
#' title = "Card header",
#' "This is a simple card with plain text,
#' but cards can also contain their own header,
#' footer, list view, image, or any other element.",
#' footer = tagList(
#' f7Button(color = "blue", label = "My button", href = "https://www.google.com"),
#' f7Badge("Badge", color = "green")
#' )
#' ),
#'
#' ),
#' f7List(
#' f7ListItem(
#' href = "https://www.google.com",
#' title = "Item 1"
#' ),
#' f7ListItem(
#' href = "https://www.google.com",
#' title = "Item 2"
#' )
#' f7ListItem(
#' href = "https://www.google.com",
#' title = "Item 1"
#' ),
#' f7ListItem(
#' href = "https://www.google.com",
#' title = "Item 2"
#' )
#' )
#' )
#' ),
#' server = function(input, output, session) {
#' observeEvent(TRUE, {
#' f7Skeleton(".card", "fade", 2)
#' }, once = TRUE)
#' }
#' )
#' )
#' ),
#' server = function(input, output, session) {
#' observeEvent(TRUE,
#' {
#' f7Skeleton(".card", "fade", 2)
#' },
#' once = TRUE
#' )
#' }
#' )
#' }
f7Skeleton <- function(
target = ".card",
effect = c("fade", "blink", "pulse"),
duration = NULL,
session = shiny::getDefaultReactiveDomain()
) {

session = shiny::getDefaultReactiveDomain()) {
effect <- match.arg(effect)
message <-dropNulls(
message <- dropNulls(
list(
target = target,
effect = effect,
Expand Down
62 changes: 30 additions & 32 deletions man/f7Skeleton.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

37 changes: 3 additions & 34 deletions man/toggle.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 355a94c

Please sign in to comment.