This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Tabs: | |
[ | |
{ | |
"caption": "Tab Title", | |
"fields": [ | |
{ | |
"field": "title", | |
"caption": "Name" | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
highlightWords = (string, highlight) => { | |
let counter = 0; | |
let str = string; | |
let index = string.toLowerCase().indexOf(highlight.toLowerCase()); | |
let result = []; | |
while(index > -1) { | |
result.push(<span key={counter++}>{str.slice(0, index)}</span>); | |
result.push(<mark key={counter++}>{str.slice(index, index + highlight.length)}</mark>); | |
str = str.slice(index + highlight.length); |