|
@ -84,7 +84,7 @@ class App extends React.Component { |
|
|
const { searchText } = this.state; |
|
|
const { searchText } = this.state; |
|
|
return searchText ? ( |
|
|
return searchText ? ( |
|
|
<span> |
|
|
<span> |
|
|
{text.split(new RegExp(`(?<=${searchText})|(?=${searchText})`, 'i')).map((fragment, i) => ( |
|
|
{text.split(new RegExp(`(${searchText})`, 'gi')).map((fragment, i) => ( |
|
|
fragment.toLowerCase() === searchText.toLowerCase() |
|
|
fragment.toLowerCase() === searchText.toLowerCase() |
|
|
? <span key={i} className="highlight">{fragment}</span> : fragment // eslint-disable-line |
|
|
? <span key={i} className="highlight">{fragment}</span> : fragment // eslint-disable-line |
|
|
))} |
|
|
))} |
|
|