Add style components for zebra-tables and responsive-tables.
This commit is contained in:
parent
8ca27a65c3
commit
a5e759d988
1 changed files with 112 additions and 2 deletions
50
assets/sass/components/tables/_tables.scss
Normal file
50
assets/sass/components/tables/_tables.scss
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
.zebra-table,
|
||||
%zebra-table {
|
||||
--padding: .5rem;
|
||||
|
||||
th,
|
||||
td {
|
||||
padding: var(--padding);
|
||||
}
|
||||
|
||||
tr:nth-child(odd) {
|
||||
background-color: var(--color-row-odd);
|
||||
}
|
||||
|
||||
tr:nth-child(even) {
|
||||
background-color: var(--color-row-even);
|
||||
}
|
||||
|
||||
// Add first-of-type to increase specificity.
|
||||
tr:first-of-type:has(th) {
|
||||
background-color: var(--color-row-header);
|
||||
}
|
||||
}
|
||||
|
||||
.responsive-table,
|
||||
%responsive-table {
|
||||
--padding: .5rem;
|
||||
|
||||
@include respond-to-max(s) {
|
||||
th,
|
||||
td {
|
||||
padding: var(--padding);
|
||||
}
|
||||
|
||||
th {
|
||||
display: none;
|
||||
}
|
||||
|
||||
td {
|
||||
display: grid;
|
||||
gap: var(--padding);
|
||||
grid-template-columns: 12ch auto;
|
||||
|
||||
&::before {
|
||||
content: attr(aria-label) ':';
|
||||
font-weight: var(--fw-bold);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in a new issue