Skip to content

Commit af31f28

Browse files
Highlight related sidebar row when result .entry is hovered
1 parent 8ed01da commit af31f28

2 files changed

Lines changed: 25 additions & 11 deletions

File tree

public/css/schedule.less

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,14 +67,22 @@
6767

6868
/* Design */
6969

70-
.schedule-detail .entry.highlighted {
71-
outline: 2px solid var(--entry-border-color);
72-
outline-offset: 1px;
73-
}
70+
.schedule-detail {
71+
.entry.highlighted {
72+
outline: 2px solid var(--entry-border-color);
73+
outline-offset: 1px;
74+
}
7475

75-
.schedule-detail .step.highlighted {
76-
background-color: @gray-lighter;
77-
border-color: @gray-light;
76+
.sidebar .row-title.highlighted,
77+
.step.highlighted {
78+
background-color: @gray-lighter;
79+
border-color: @gray-light;
80+
}
81+
82+
.sidebar .row-title.highlighted {
83+
margin-top: -1px; // cover the border-top area
84+
padding-top: 1px;
85+
}
7886
}
7987

8088
.schedule-detail .from-scratch-hint {

public/js/schedule.js

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -79,12 +79,15 @@
7979
const entry = event.currentTarget;
8080
const overlay = entry.parentElement;
8181
const grid = overlay.previousSibling;
82+
const sideBar = grid.previousSibling;
8283

8384
let relatedElements;
8485
if ('rotationPosition' in entry.dataset) {
85-
relatedElements = grid.querySelectorAll(
86-
'[data-y-position="' + entry.dataset.rotationPosition + '"]'
86+
relatedElements = Array.from(
87+
grid.querySelectorAll('[data-y-position="' + entry.dataset.rotationPosition + '"]')
8788
);
89+
90+
relatedElements.push(sideBar.childNodes[Number(entry.dataset.rotationPosition)]);
8891
} else {
8992
relatedElements = overlay.querySelectorAll(
9093
'[data-rotation-position="' + entry.dataset.entryPosition + '"]'
@@ -116,12 +119,15 @@
116119
const entry = event.currentTarget;
117120
const overlay = entry.parentElement;
118121
const grid = overlay.previousSibling;
122+
const sideBar = grid.previousSibling;
119123

120124
let relatedElements;
121125
if ('rotationPosition' in entry.dataset) {
122-
relatedElements = grid.querySelectorAll(
123-
'[data-y-position="' + entry.dataset.rotationPosition + '"]'
126+
relatedElements = Array.from(
127+
grid.querySelectorAll('[data-y-position="' + entry.dataset.rotationPosition + '"]')
124128
);
129+
130+
relatedElements.push(sideBar.childNodes[Number(entry.dataset.rotationPosition)]);
125131
} else {
126132
relatedElements = overlay.querySelectorAll(
127133
'[data-rotation-position="' + entry.dataset.entryPosition + '"]'

0 commit comments

Comments
 (0)