-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.R
71 lines (64 loc) · 1.91 KB
/
app.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
library(shiny)
library(flipcard)
ui <- fluidPage(
titlePanel("reactR Input Example"),
wellPanel(style = "width:400px;", "Quick Example demonstrating flipping in Shiny."),
actionButton("btnflip", "Flip card"),
flipcardInput(
"flipInput",
configuration = list(
containerStyle = list(width = "400px", height = "400px"),
front = list(
tag = "img",
props = list(
src = "//static.pexels.com/photos/59523/pexels-photo-59523.jpeg",
style = list(height = "100%", width = "100%")
),
content = NULL
),
back = list(
tag = "img",
props = list(
src = "//img.buzzfeed.com/buzzfeed-static/static/2014-04/enhanced/webdr06/4/16/enhanced-11136-1396643149-13.jpg?no-auto",
style = list(height = "100%", width = "100%")
),
content = NULL
)
)
)
)
server <- function(input, output, session) {
# reactive value for flipped state
isFlipped <- reactiveVal(FALSE)
observeEvent(input$btnflip, {
# toggle flipped
isFlipped(!isFlipped())
# send update to flipcard
flipcard::updateFlipcardInput(
session = session,
inputId = "flipInput",
value = NULL,
configuration = list(
containerStyle = list(width = "400px", height = "400px"),
isFlipped = isFlipped(),
front = list(
tag = "img",
props = list(
src = "//static.pexels.com/photos/59523/pexels-photo-59523.jpeg",
style = list(height = "100%", width = "100%")
),
content = NULL
),
back = list(
tag = "img",
props = list(
src = "//img.buzzfeed.com/buzzfeed-static/static/2014-04/enhanced/webdr06/4/16/enhanced-11136-1396643149-13.jpg?no-auto",
style = list(height = "100%", width = "100%")
),
content = NULL
)
)
)
})
}
shinyApp(ui, server)