# NOT RUN {
if (interactive()) {
library(shiny)
library(shinyMobile)
shiny::shinyApp(
ui = f7Page(
title = "My app",
init = f7Init(skin = "ios", theme = "light"),
f7SingleLayout(
navbar = f7Navbar(
title = "Single Layout",
hairline = FALSE,
shadow = TRUE,
left_panel = TRUE,
right_panel = TRUE
),
panels = tagList(
f7Panel(side = "left", inputId = "mypanel1"),
f7Panel(side = "right", inputId = "mypanel2")
),
toolbar = f7Toolbar(
position = "bottom",
icons = TRUE,
hairline = FALSE,
shadow = FALSE,
f7Link(label = "Link 1", src = "https://www.google.com"),
f7Link(label = "Link 2", src = "https://www.google.com", external = TRUE)
),
# main content
f7Shadow(
intensity = 10,
hover = TRUE,
f7Card(
title = "Card header",
sliderInput("obs", "Number of observations", 0, 1000, 500),
h1("You only see me by opening the left panel"),
plotOutput("distPlot"),
footer = tagList(
f7Button(color = "blue", label = "My button", src = "https://www.google.com"),
f7Badge("Badge", color = "green")
)
)
)
)
),
server = function(input, output, session) {
observeEvent(input$mypanel2, {
state <- if (input$mypanel2) "open" else "closed"
f7Toast(
session,
text = paste0("Right panel is ", state),
position = "center",
closeTimeout = 1000,
closeButton = FALSE
)
})
output$distPlot <- renderPlot({
if (input$mypanel1) {
dist <- rnorm(input$obs)
hist(dist)
}
})
}
)
}
# }
Run the code above in your browser using DataLab