Skip to content

Commit 5e82986

Browse files
Highlight related sidebar row when result .entry is hovered
1 parent 626d0c6 commit 5e82986

File tree

2 files changed

+25
-11
lines changed

2 files changed

+25
-11
lines changed

public/css/schedule.less

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

7070
/* Design */
7171

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

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

8290
.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 + '"]'
@@ -101,12 +104,15 @@
101104
const entry = event.currentTarget;
102105
const overlay = entry.parentElement;
103106
const grid = overlay.previousSibling;
107+
const sideBar = grid.previousSibling;
104108

105109
let relatedElements;
106110
if ('rotationPosition' in entry.dataset) {
107-
relatedElements = grid.querySelectorAll(
108-
'[data-y-position="' + entry.dataset.rotationPosition + '"]'
111+
relatedElements = Array.from(
112+
grid.querySelectorAll('[data-y-position="' + entry.dataset.rotationPosition + '"]')
109113
);
114+
115+
relatedElements.push(sideBar.childNodes[Number(entry.dataset.rotationPosition)]);
110116
} else {
111117
relatedElements = overlay.querySelectorAll(
112118
'[data-rotation-position="' + entry.dataset.entryPosition + '"]'

0 commit comments

Comments
 (0)