Skip to content

Commit

Permalink
Better visual selected state for table rows
Browse files Browse the repository at this point in the history
  • Loading branch information
bastianallgeier committed Dec 13, 2024
1 parent b97b606 commit a5d6c7e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
19 changes: 15 additions & 4 deletions panel/src/components/Layout/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,8 @@
:class="{
'k-table-sortable-row': rowIsSortable(row)
}"
:data-selectable="rowIsSelectable(row)"
:data-sortable="rowIsSortable(row)"
>
<!-- Index & drag handle -->
<td
Expand Down Expand Up @@ -395,7 +397,7 @@ export default {
:root {
--table-cell-padding: var(--spacing-3);
--table-color-back: light-dark(var(--color-white), var(--color-gray-850));
--table-color-border: var(--panel-color-back);
--table-color-border: light-dark(rgba(0, 0, 0, 0.08), rgba(0, 0, 0, 0.375));
--table-color-hover: light-dark(var(--color-gray-100), rgba(0, 0, 0, 0.1));
--table-color-th-back: light-dark(
var(--color-gray-100),
Expand Down Expand Up @@ -481,6 +483,9 @@ export default {
}
/* Table Body */
.k-table tbody tr td {
background: var(--table-color-back);
}
.k-table tbody tr:hover td {
background: var(--table-color-hover);
}
Expand Down Expand Up @@ -532,17 +537,23 @@ export default {
}
/* Table Index with sort handle */
.k-table .k-table-index-column .k-sort-handle {
.k-table tr[data-sortable="true"] .k-table-index-column .k-sort-handle {
--button-width: 100%;
display: none;
}
.k-table tr.k-table-sortable-row:hover .k-table-index-column .k-table-index {
.k-table tr[data-sortable="true"]:hover .k-table-index-column .k-table-index {
display: none;
}
.k-table tr.k-table-sortable-row:hover .k-table-index-column .k-sort-handle {
.k-table tr[data-sortable="true"]:hover .k-table-index-column .k-sort-handle {
display: flex;
}
/* Selectable rows */
.k-table tr[data-selectable="true"]:has(.k-table-index-column input:checked) {
--table-color-back: light-dark(var(--color-blue-250), var(--color-blue-800));
--table-color-hover: var(--table-color-back);
}
/* Table Options */
.k-table .k-table-options-column {
padding: 0;
Expand Down
2 changes: 2 additions & 0 deletions panel/src/styles/config/colors.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@

--color-blue-l-100: calc(var(--color-l-100) + var(--color-blue-boost));
--color-blue-l-200: calc(var(--color-l-200) + var(--color-blue-boost));
--color-blue-l-250: calc(var(--color-l-250) + var(--color-blue-boost));
--color-blue-l-300: calc(var(--color-l-300) + var(--color-blue-boost));
--color-blue-l-400: calc(var(--color-l-400) + var(--color-blue-boost));
--color-blue-l-500: calc(var(--color-l-500) + var(--color-blue-boost));
Expand All @@ -160,6 +161,7 @@

--color-blue-100: hsl(var(--color-blue-hs), var(--color-blue-l-100));
--color-blue-200: hsl(var(--color-blue-hs), var(--color-blue-l-200));
--color-blue-250: hsl(var(--color-blue-hs), var(--color-blue-l-250));
--color-blue-300: hsl(var(--color-blue-hs), var(--color-blue-l-300));
--color-blue-400: hsl(var(--color-blue-hs), var(--color-blue-l-400));
--color-blue-500: hsl(var(--color-blue-hs), var(--color-blue-l-500));
Expand Down

0 comments on commit a5d6c7e

Please sign in to comment.