-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathWidget Gallery Test File
110 lines (105 loc) · 2.98 KB
/
Widget Gallery Test File
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
widget_data <- df4
ui <- fluidPage(
titlePanel("Widget Gallery"),
sidebarLayout(
sidebarPanel(
div(class = "search-bar",
textInput(inputId = "search", label = NULL, placeholder = "Search")
)
),
mainPanel(
tags$head(
tags$style(HTML("
.widget-button {
padding: 50px;
font-size: 24px;
background-color: #6FB7B7;
color: #FFFFFF;
border-radius: 10px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
margin-bottom: 10px;
}
.search-bar {
width: 200px;
height: 30px;
background-color: #F0F0F0;
border: none;
border-radius: 5px;
padding: 5px;
margin-bottom: 10px;
margin-left: 10px;
}
"))
),
fluidRow(
column(width = 6, class = "widget-button", actionButton(
inputId = "widget_Errorcode",
label = "Errorcode"
)),
column(width = 6, class = "widget-button", actionButton(
inputId = "widget_Häufigkeit",
label = "Häufigkeit"
)),
column(width = 6, class = "widget-button", "NA"),
column(width = 6, class = "widget-button", "NA"),
column(width = 6, class = "widget-button", "NA"),
column(width = 6, class = "widget-button", "NA")
)
)
)
)
server <- function(input, output, session) {
observeEvent(input$widget_Errorcode, {
showModal(
modalDialog(
title = "Errorcode",
withTags({
tags$head(
tags$style(HTML("
.error-box {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 5px;
padding: 15px;
margin-bottom: 10px;
}
.frequency-box {
background-color: #f8f9fa;
border: 1px solid #dee2e6;
border-radius: 5px;
padding: 15px;
}
"))
)
lapply(seq_along(widget_data$Errorcode), function(i) {
fluidRow(
column(
width = 4,
div(
class = "error-box",
tags$h4(widget_data$Errorcode[i]),
actionButton(inputId = paste0("button", i), label = "Select")
)
),
column(
width = 8,
conditionalPanel(
condition = paste0("input.button", i, " > 0"),
div(
class = "frequency-box",
tags$h4("Frequency"),
tags$p(widget_data$Häufigkeit[i])
)
)
)
)
})
})
)
)
})
observeEvent(input$button, {
updateActionButton(session, inputId = paste0("button", input$button), label = "Select")
})
}
shinyApp(ui, server)