Skip to content

Commit

Permalink
Merge pull request #78 from cmd-ntrf/jupyterlab4
Browse files Browse the repository at this point in the history
improve feedback on hover of Load/Unload module button
  • Loading branch information
cmd-ntrf authored Nov 7, 2024
2 parents 310860d + a51213d commit 58a8f7d
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 8 deletions.
17 changes: 13 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,21 @@ class ModuleWidget extends Widget {
if (target.tagName == 'SPAN') {
show_module(target.innerText);
} else if(target.tagName == 'BUTTON') {
const span = event.target.closest('li').querySelector('span');
const item = span.innerText;
const parent_li = event.target.closest('li');
const mod_label = parent_li.querySelector('span');
const mod_name = mod_label.innerText;
if(target.innerText == 'Load') {
await load_module(item);
target.innerText = 'Loading...';
target.style.visibility = 'visible';
target.style.backgroundColor = "#99b644";
parent_li.style.backgroundColor = "#dde6c0";
await load_module(mod_name);
} else if(target.innerText == 'Unload') {
await moduleAPI.unload([item]);
target.innerText = 'Unloading...';
target.style.visibility = 'visible';
target.style.backgroundColor = "#ee8b44";
parent_li.style.backgroundColor = "#fad7c0";
await moduleAPI.unload([mod_name]);
}
this.update();
}
Expand Down
13 changes: 9 additions & 4 deletions style/index.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 58a8f7d

Please sign in to comment.