Skip to content

Commit 9257627

Browse files
Dan billing (#1623)
1 parent df80158 commit 9257627

File tree

3 files changed

+29
-1
lines changed

3 files changed

+29
-1
lines changed

pgml-dashboard/src/components/tables/small/table/mod.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ pub struct Table {
77
classes: String,
88
headers: Vec<String>,
99
rows: Vec<Component>,
10+
footers: Vec<Component>,
1011
}
1112

1213
impl Table {
@@ -15,8 +16,14 @@ impl Table {
1516
headers: headers.iter().map(|h| h.to_string()).collect(),
1617
classes: "table table-sm".into(),
1718
rows: rows.to_vec(),
19+
footers: vec![],
1820
}
1921
}
22+
23+
pub fn footers(mut self, footer: Vec<Component>) -> Self {
24+
self.footers = footer;
25+
self
26+
}
2027
}
2128

2229
component!(Table);

pgml-dashboard/src/components/tables/small/table/table.scss

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ table.table.table-sm {
1111
background: transparent;
1212
text-transform: uppercase;
1313
font-size: 12px;
14-
padding: 12px 12px 12px 0;
14+
padding: 12px 12px 12px 0.25rem;
1515
border-bottom: 1px solid #{$gray-600};
1616
font-weight: #{$font-weight-semibold};
1717
}
@@ -28,6 +28,18 @@ table.table.table-sm {
2828
}
2929
}
3030

31+
tfoot {
32+
td {
33+
color: #{$gray-300};
34+
background: transparent;
35+
text-transform: uppercase;
36+
font-size: 12px;
37+
padding: 12px 12px 0px .25rem;
38+
border-top: 1px solid #{$gray-600};
39+
font-weight: #{$font-weight-semibold};
40+
}
41+
}
42+
3143
border-collapse: separate;
3244
border-spacing: 0 12px;
3345
}

pgml-dashboard/src/components/tables/small/table/template.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,13 @@
1111
<%+ row %>
1212
<% } %>
1313
</tbody>
14+
<% if !footers.is_empty() {%>
15+
<tfoot>
16+
<tr>
17+
<% for footer in footers { %>
18+
<td><%+ footer %></td>
19+
<% } %>
20+
</tr>
21+
</tfoot>
22+
<% } %>
1423
</table>

0 commit comments

Comments
 (0)