Guest User

Untitled

a guest
Jan 16th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.76 KB | None | 0 0
  1. Kate <span style="color:green">Bus</span>h
  2.  
  3. // Called from within render() to wrap a span around a search term embedded in the artist, album or track name
  4. underlineSearch(displayString) {
  5. let searchTerm = this.props.searchTerm;
  6.  
  7. if (displayString.indexOf(searchTerm) !== -1) {
  8. displayString = displayString.replace(searchTerm, '<span style="color:green">'+searchTerm+'</span>');
  9. }
  10. return displayString;
  11. }
  12.  
  13. render() {
  14. return (
  15. <div className="Track" id="Track">
  16. <div className="Track-information">
  17. <h3>{this.underlineSearch(this.props.trackName)}</h3>
  18. <p>{this.underlineSearch(this.props.artistName)} | {this.underlineSearch(this.props.albumName)}</p>
  19. </div>
  20. </div>
  21. );
  22. }
Add Comment
Please, Sign In to add comment