Repository navigation
Expand file tree
/
Copy pathtable-sort.css
More file actions
99 lines (81 loc) · 1.94 KB
/
Copy pathtable-sort.css
File metadata and controls
99 lines (81 loc) · 1.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
.table-body {
display: flex;
flex-direction: column;
}
.table-row {
order: calc(var(--order) * var(--sort-order, -1));
}
#sort-by-published:checked ~ .table > .table-body > .table-row {
--order: var(--order-by-published);
}
#sort-by-views:checked ~ .table > .table-body > .table-row {
--order: var(--order-by-views);
}
#sort-ascending:checked + .table {
--sort-order: 1;
}
#sort-by-name:checked ~ #sort-ascending:checked + .table > .table-body {
flex-direction: column-reverse;
}
/* Then, everything else: table display, input controls etc. */
.table-wrapper > input {
position: fixed;
left: 0;
right: 0;
clip: rect(1px,1px,1px,1px);
visibility: hidden;
}
.table,
.table-caption,
.table-head {
display: block;
margin: 0;
}
.table-row {
position: relative;
display: grid;
grid-template-columns: 1fr 7em 4.3em;
}
.table-cell {
text-align: right;
padding: 0.25em 0.5em;
white-space: nowrap;
}
.table-cell:first-child {
text-align: left;
overflow: hidden;
text-overflow: ellipsis;
}
.table-orderer {
display: none;
}
.table-head .table-cell {
position: relative;
display: flex;
user-select: none;
}
.table-head .table-cell:hover {
background: rgba(0,0,0,0.05);
}
.table-head .table-cell:not(:first-child) {
flex-direction: row-reverse;
}
.table-sorter:before,
.table-orderer:before {
content: "";
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
cursor: pointer;
}
#sort-by-name:checked ~ .table .table-sorter[for=sort-by-name] ~ .table-orderer,
#sort-by-published:checked ~ .table .table-sorter[for=sort-by-published] ~ .table-orderer,
#sort-by-views:checked ~ .table .table-sorter[for=sort-by-views] ~ .table-orderer {
display: inline;
}
#sort-ascending:checked + .table .table-orderer[for=sort-ascending],
#sort-ascending:not(:checked) + .table .table-orderer[for=sort-descending] {
display: none !important;
}