Skip to content

Commit

Permalink
Highlighting on search is completed and is in working order
Browse files Browse the repository at this point in the history
  • Loading branch information
Swaathik committed Mar 26, 2020
1 parent ff0015e commit fc03e41
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/draw-tree/draw-nodes/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,14 @@ export default global => {
.attr('fill', colors.off);
}

node.selectAll(`.${global.classnames.name}`).attr('fill', node => {
if (global.searchTerm) {
const name = node.data.name ? node.data.name.toLowerCase() : '';
if (name.startsWith(global.searchTerm.toLowerCase())) return '#8B0000';
}
return '#000000';
});

// Node exit
node.exit().remove();

Expand Down

0 comments on commit fc03e41

Please sign in to comment.