Skip to content

Commit f25077f

Browse files
committed
Collapsible about box toegevoegd
1 parent efa57cb commit f25077f

1 file changed

Lines changed: 67 additions & 6 deletions

File tree

ui.R

Lines changed: 67 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -81,13 +81,74 @@ ui <- fluidPage(
8181
"<br>"
8282
)
8383
),
84-
# --- About Box ---
85-
div(class = "about-box",
86-
h4("About"),
87-
p("Add a small descriptive text about the app here.")
84+
# --- Collapsible About Box ---
85+
tags$head(
86+
tags$link(rel = "stylesheet", href = "https://fonts.googleapis.com/icon?family=Material+Icons"),
87+
tags$style(HTML("
88+
.collapsible-section summary::-webkit-details-marker {
89+
display: none;
90+
}
91+
.readmore {
92+
font-weight: normal;
93+
font-size: inherit;
94+
color: #004d40;
95+
text-decoration: underline;
96+
}
97+
.collapsible-header {
98+
display: flex;
99+
align-items: center;
100+
justify-content: space-between;
101+
cursor: pointer;
102+
font-size: 16px;
103+
font-weight: bold;
104+
margin-bottom: 5px;
105+
}
106+
.collapsible-header .expand-icon {
107+
transition: transform 0.3s ease;
108+
font-size: 24px;
109+
color: #555;
110+
}
111+
details[open] .expand-icon {
112+
transform: rotate(180deg);
113+
}
114+
"))
88115
),
89-
br(),
90-
# --- End About Box ---
116+
117+
tags$details(
118+
id = "aboutCollapse",
119+
class = "collapsible-section",
120+
tags$summary(
121+
class = "collapsible-header",
122+
HTML('<span>About</span><i class="material-icons expand-icon">expand_more</i>')
123+
),
124+
p("Add a small descriptive text about the app here."),
125+
tags$a(
126+
"Learn more",
127+
href = "https://example.com", # Change to your real link
128+
class = "readmore",
129+
target = "_blank"
130+
)
131+
),
132+
133+
tags$script(HTML("
134+
document.addEventListener('DOMContentLoaded', function() {
135+
var el = document.getElementById('aboutCollapse');
136+
if (el) {
137+
var summary = el.querySelector('summary');
138+
summary.addEventListener('click', function(e) {
139+
setTimeout(function() {
140+
var icon = summary.querySelector('.expand-icon');
141+
if (el.hasAttribute('open')) {
142+
icon.style.transform = 'rotate(180deg)';
143+
} else {
144+
icon.style.transform = 'rotate(0deg)';
145+
}
146+
}, 100);
147+
});
148+
}
149+
});
150+
")),
151+
# --- End Collapsible About Box ---
91152

92153
# Custom button styles
93154
tags$head(

0 commit comments

Comments
 (0)