Skip to content

Commit 6443459

Browse files
accordion add ability to have small titles (#1477)
1 parent 7df1e83 commit 6443459

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

pgml-dashboard/src/components/accordian/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ pub struct Accordian {
1111
html_contents: Vec<String>,
1212
html_titles: Vec<String>,
1313
selected: usize,
14+
small_titles: bool,
1415
}
1516

1617
impl Accordian {
@@ -19,6 +20,7 @@ impl Accordian {
1920
html_contents: Vec::new(),
2021
html_titles: Vec::new(),
2122
selected: 0,
23+
small_titles: false,
2224
}
2325
}
2426

@@ -31,6 +33,11 @@ impl Accordian {
3133
self.html_titles = html_titles.into_iter().map(|s| s.to_string()).collect();
3234
self
3335
}
36+
37+
pub fn small_titles(mut self, small_titles: bool) -> Self {
38+
self.small_titles = small_titles;
39+
self
40+
}
3441
}
3542

3643
component!(Accordian);

pgml-dashboard/src/components/accordian/template.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@
55
<div class="accordian-item">
66
<div class="accordian-header <% if i == selected { %> selected <% } %>" data-action="click->accordian#titleClick" data-value="accordian-body<%= i %>">
77
<div class="d-flex justify-content-between align-items-center w-100">
8+
<% if small_titles {%>
9+
<h6 class="mb-0"><%- html_titles[i] %></h6>
10+
<% } else { %>
811
<h4 class="mb-0"><%- html_titles[i] %></h4>
12+
<% } %>
913
<span class="add material-symbols-outlined">add</span>
1014
<span class="remove material-symbols-outlined">remove</span>
1115
</div>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy