Skip to content

Commit 85c078d

Browse files
authored
Fix table styling (#1381)
1 parent ad1ec84 commit 85c078d

File tree

4 files changed

+75
-42
lines changed

4 files changed

+75
-42
lines changed

pgml-dashboard/.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
DATABASE_URL=postgres:///pgml_dashboard_development
22
DEV_MODE=true
33
RUST_LOG=debug,tantivy=error,rocket=info
4+
SITE_SEARCH_DATABASE_URL=postgres:///pgml_dashboard_development

pgml-dashboard/src/components/tables/large/row/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ impl Row {
1414
pub fn new(columns: &[Component]) -> Row {
1515
Row {
1616
columns: columns.to_vec(),
17-
action: "click->tables-large-table#selectRow".to_string(),
17+
action: "".to_string(),
1818
data: vec![],
1919
}
2020
}
@@ -28,6 +28,10 @@ impl Row {
2828
self.data.push((name.to_owned(), value.to_owned()));
2929
self
3030
}
31+
32+
pub fn selectable(self) -> Self {
33+
self.action("click->tables-large-table#selectRow")
34+
}
3135
}
3236

3337
component!(Row);

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ impl Table {
2121

2222
pub fn selectable(mut self) -> Self {
2323
self.classes.push_str(" selectable");
24+
self.rows = self.rows.into_iter().map(|r| r.selectable()).collect();
2425
self
2526
}
2627
}
Lines changed: 68 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,81 @@
11
table.table.table-lg {
2-
td, tr, th {
3-
border-width: 0;
4-
}
2+
td,
3+
tr,
4+
th {
5+
border-width: 0;
6+
}
57

6-
border-collapse: separate;
7-
border-spacing: 0 16px;
8+
border-collapse: separate;
9+
border-spacing: 0 16px;
810

9-
thead {
10-
th {
11-
color: #{$slate-shade-100};
12-
background: #{$gray-800};
13-
text-transform: uppercase;
14-
font-size: 0.75rem;
15-
padding: 16px 0;
11+
thead {
12+
th {
13+
color: #{$slate-shade-100};
14+
background: #{$gray-800};
15+
text-transform: uppercase;
16+
font-size: 0.75rem;
17+
padding: 16px 0;
1618

17-
&:first-of-type {
18-
padding-left: 67px;
19-
}
20-
}
19+
&:first-of-type {
20+
padding-left: 67px;
21+
}
2122
}
2223

23-
tbody {
24-
tr {
25-
&:hover, &.active {
26-
td {
27-
background: #{$gray-800};
28-
}
29-
}
30-
31-
td {
32-
background: #{$gray-600};
33-
vertical-align: middle;
34-
padding: 20px 0;
35-
36-
&:first-of-type {
37-
padding-left: 67px;
38-
}
39-
}
40-
}
24+
tr {
25+
th:first-child {
26+
border-top-left-radius: $border-radius;
27+
}
28+
th:last-child {
29+
border-top-right-radius: $border-radius;
30+
}
4131
}
32+
}
33+
34+
tbody {
35+
tr {
36+
&.active {
37+
td {
38+
background: #{$gray-800};
39+
}
40+
}
4241

43-
&.selectable {
44-
tbody {
45-
tr:hover {
46-
cursor: pointer;
47-
}
42+
td {
43+
background: #{$gray-600};
44+
vertical-align: middle;
45+
padding: 20px 0;
46+
47+
&:first-of-type {
48+
padding-left: 67px;
4849
}
50+
}
51+
52+
td:first-child {
53+
border-top-left-radius: $border-radius;
54+
border-bottom-left-radius: $border-radius;
55+
}
56+
td:last-child {
57+
border-top-right-radius: $border-radius;
58+
border-bottom-right-radius: $border-radius;
59+
}
4960
}
61+
}
62+
63+
&.selectable {
64+
--bs-table-hover-bg: #{$gray-700};
5065

51-
.table-cell-content {
52-
height: 100%;
66+
tbody {
67+
tr:hover {
68+
cursor: pointer;
69+
background: #{$gray-800};
70+
}
5371
}
72+
}
73+
74+
& {
75+
--bs-table-hover-bg: #{$gray-600};
76+
}
77+
78+
.table-cell-content {
79+
height: 100%;
80+
}
5481
}

0 commit comments

Comments
 (0)