Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mock_frame() #1

Open
ColinFay opened this issue Sep 5, 2019 · 0 comments
Open

mock_frame() #1

ColinFay opened this issue Sep 5, 2019 · 0 comments

Comments

@ColinFay
Copy link
Member

ColinFay commented Sep 5, 2019

I think {shinipsum} should support a zoning functionality to mock shiny app UI blocks:

mock_frame <- function(n, o, txt){
  mapply(function(x, y, z){
    column(
      x, 
      class = "mock", 
      tagList(
        lapply(1:y, function(x) tags$p(HTML("&nbsp;"))), 
        p(class = "mockover", z)
      )
    )
  }, x = n, y = o, z = txt, SIMPLIFY = FALSE)
}

library(shiny)
ui <- function(request){
  fluidPage(
    tags$style(
      '.mock{
        border-width:2px;
        border-style:solid;
        border-color:black;
        margin: 1em;
      }
      .mockover{
        text-align: center;
      }'
    ),
    mock_frame(
      c(1, 2, 6, 1, 12), 
      c(2, 3, 4, 1, 4), 
      c("the frame with this", 
        "the frame with that", 
        "here a graph", 
        "an a knob", 
        "and this ")
    )
  )
}

server <- function(input, output, session){
  
}

shinyApp(ui, server)

Screenshot 2019-09-05 at 16 40 57

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

No branches or pull requests

1 participant