Skip to content

Commit abbb67d

Browse files
authoredFeb 9, 2018
Merge pull request #2341 from plotly/react
Plotly.react
2 parents ef2bff1 + 5d6a4a0 commit abbb67d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1433
-527
lines changed
 

‎devtools/test_dashboard/devtools.js

+14-2
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function searchMocks(e) {
202202

203203
results.forEach(function(r) {
204204
var result = document.createElement('span');
205-
result.className = 'search-result';
205+
result.className = getResultClass(r.name);
206206
result.innerText = r.name;
207207

208208
result.addEventListener('click', function() {
@@ -212,6 +212,10 @@ function searchMocks(e) {
212212
// Clear plots and plot selected.
213213
Tabs.purge();
214214
Tabs.plotMock(mockName);
215+
216+
mocksList.querySelectorAll('span').forEach(function(el) {
217+
el.className = getResultClass(el.innerText);
218+
});
215219
});
216220

217221
mocksList.appendChild(result);
@@ -222,8 +226,16 @@ function searchMocks(e) {
222226
});
223227
}
224228

229+
function getNameFromHash() {
230+
return window.location.hash.replace(/^#/, '');
231+
}
232+
233+
function getResultClass(name) {
234+
return 'search-result' + (getNameFromHash() === name ? ' search-result__selected' : '');
235+
}
236+
225237
function plotFromHash() {
226-
var initialMock = window.location.hash.replace(/^#/, '');
238+
var initialMock = getNameFromHash();
227239

228240
if(initialMock.length > 0) {
229241
Tabs.plotMock(initialMock);

‎devtools/test_dashboard/style.css

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ header span{
5656
color: #fff;
5757
background-color: #4983EC;
5858
}
59+
.search-result__selected{
60+
background-color: #DDDDEE;
61+
}
5962
#plots{
6063
overflow: scroll;
6164
}

0 commit comments

Comments
 (0)
Please sign in to comment.