Giter Club home page Giter Club logo

Comments (2)

DivadNojnarg avatar DivadNojnarg commented on May 28, 2024

As a backup:

#' Multi views layout
#'
#' @param ... Slot for \link{f7View}.
#' @export
f7ViewLayout <- function(...) {

  items <- list(...)
  tabbarItems <- lapply(seq_along(items), function(i) {
    temp <- items[[i]][[1]]
    icon <- items[[i]][[2]]
    isActive <- length(grep(x = temp$attribs$class, pattern = "tab-active")) == 1
    shiny::a(
      href = paste0("#", temp$attribs$`data-name`),
      class = if (isActive) "tab-link tab-link-active" else "tab-link",
      icon
    )
  })

  viewTabbar <- shiny::tags$div(
    class = "toolbar tabbar toolbar-bottom",
    shiny::tags$div(
      class = "toolbar-inner",
      tabbarItems
    )
  )

  shiny::tagList(
    f7InputsDeps(),
    shiny::tags$div(
      class = "views tabs",
      # the menu must come first!
      lapply(seq_along(items), function(i) items[[i]][[1]])
    )
  )
}



#' Create an f7View
#'
#' A child of \link{f7ViewLayout}
#'
#' @param ... View content.
#' @param id View unique id
#' @param name View name: ie "view-main". If you specify "view-main", it will be
#' the main view.
#' @param main Whether it is the main view.
#' @param active Whether to start on that view. Only 1 view may be active at a time.
#' @param icon Icon.
#' @export
f7View <- function(..., id, name, main = FALSE, active = FALSE, icon = NULL) {

  viewCl <- paste("view tab")
  if (main) viewCl <- paste(viewCl, "view-main")
  if (active) viewCl <- paste(viewCl, "tab-active")

  list(
    shiny::tags$div(
      id = id,
      `data-name` = name,
      class = viewCl,
      ...
    ),
    icon
  )
}

from shinymobile.

DivadNojnarg avatar DivadNojnarg commented on May 28, 2024

See opened POC and {brochure}

from shinymobile.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.