Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions pgml-dashboard/src/components/tables/small/table/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ pub struct Table {
classes: String,
headers: Vec<String>,
rows: Vec<Component>,
footers: Vec<Component>,
}

impl Table {
Expand All @@ -15,8 +16,14 @@ impl Table {
headers: headers.iter().map(|h| h.to_string()).collect(),
classes: "table table-sm".into(),
rows: rows.to_vec(),
footers: vec![],
}
}

pub fn footers(mut self, footer: Vec<Component>) -> Self {
self.footers = footer;
self
}
}

component!(Table);
14 changes: 13 additions & 1 deletion pgml-dashboard/src/components/tables/small/table/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ table.table.table-sm {
background: transparent;
text-transform: uppercase;
font-size: 12px;
padding: 12px 12px 12px 0;
padding: 12px 12px 12px 0.25rem;
border-bottom: 1px solid #{$gray-600};
font-weight: #{$font-weight-semibold};
}
Expand All @@ -28,6 +28,18 @@ table.table.table-sm {
}
}

tfoot {
td {
color: #{$gray-300};
background: transparent;
text-transform: uppercase;
font-size: 12px;
padding: 12px 12px 0px .25rem;
border-top: 1px solid #{$gray-600};
font-weight: #{$font-weight-semibold};
}
}

border-collapse: separate;
border-spacing: 0 12px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,13 @@
<%+ row %>
<% } %>
</tbody>
<% if !footers.is_empty() {%>
<tfoot>
<tr>
<% for footer in footers { %>
<td><%+ footer %></td>
<% } %>
</tr>
</tfoot>
<% } %>
</table>