feat: Change table styles

- Add styles from module to tables file
- Remove tables module
- Assign styles as depended classes instead of repeating element names
- Add draggable style for table
This commit is contained in:
sthag 2026-02-21 14:08:30 +01:00
parent 91d136f1c3
commit 69535d87ac
4 changed files with 119 additions and 99 deletions

View file

@ -4,6 +4,7 @@
@use "../global/common";
@use "../global/typography";
@use "../elements/grouping";
@use "../functions/color" as *;
// Tabular data
// -----------------------------------------------------------------------------
@ -25,37 +26,77 @@ table {
margin: config.$margin_double;
border: config.$border_basic;
border-collapse: collapse;
}
.table_blank {
border: config.$width_border_basic solid transparent;
&.blank {
border: config.$width_border_basic solid transparent;
th, td {
th, td {
border: config.$width_border_basic solid transparent;
}
}
&.free {
border: config.$width_border_basic solid transparent;
}
}
.table_free {
border: config.$width_border_basic solid transparent;
}
&.stripe {
td {
border-top: 0;
border-bottom: 0;
}
.table_stripe {
td {
border-top: 0;
border-bottom: 0;
tr:nth-child(even) td {
background-color: color.scale(config.$color_back_basic, $lightness: config.$color_diff_tiny);
}
}
tr:nth-child(even) td {
background-color: color.scale(config.$color_back_basic, $lightness: config.$color_diff_tiny);
&.fix {
table-layout: fixed;
}
}
.table_fix {
table-layout: fixed;
}
&.table_file_simple {
@extend .width_full;
}
.table_file_simple {
@extend .width_full;
&.draggable tbody tr {
transition: opacity 0.2s;
&.dragging {
opacity: 0.5;
}
}
&.link {
width: 100%;
border: 0;
table-layout: auto;
tbody {
border-bottom: config.$border_basic;
&:hover {
background-color: config.$color_bright;
}
td:nth-child(2) {
width: 100%;
}
}
th,
td {
border: 0;
}
thead th,
tbody tr:nth-child(1) td {
&:last-child {
@extend .rigid;
width: 1%;
text-align: center;
}
}
}
}
// Caption
@ -116,6 +157,41 @@ th, td {
&.rigid {
white-space: nowrap;
}
&.icon {
width: 48px;
text-align: center;
img {
vertical-align: text-top;
}
}
&.link {
padding-right: config.$space_basic;
padding-left: config.$space_basic;
&:hover {
background-color: basic_color(foxtrot);
span {
display: none;
}
a {
display: block;
color: config.$color_highlight_basic;
}
}
span {
display: block;
}
a {
display: none;
}
}
}
th {
@ -139,6 +215,22 @@ td {
text-overflow: ellipsis;
white-space: nowrap;
}
&.text {
padding-right: config.$space_basic;
padding-left: config.$space_basic;
text-align: left;
div {
width: 100%;
}
.shorten {
@extend %short;
max-height: 44px;
}
}
}
td:last-child {