mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 13:28:36 +03:00
more lint fixes
This commit is contained in:
@@ -5,10 +5,10 @@ import '../scss/search.scss'
|
||||
import SearchRow from './SearchRow.jsx'
|
||||
|
||||
class Search extends React.Component {
|
||||
constructor(props) {
|
||||
constructor (props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
isFolded : true,
|
||||
isFolded: true,
|
||||
searchResults: [],
|
||||
queryString: ''
|
||||
}
|
||||
@@ -55,7 +55,7 @@ class Search extends React.Component {
|
||||
</div>
|
||||
<div class='search-results'>
|
||||
{this.state.searchResults.map(result => {
|
||||
return <SearchRow query={this.props.queryString} category={result.category} location={result.location} date={result.date} description={result.description} />
|
||||
return <SearchRow query={this.props.queryString} category={result.category} location={result.location} date={result.date} description={result.description} />
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
@@ -64,4 +64,4 @@ class Search extends React.Component {
|
||||
}
|
||||
}
|
||||
|
||||
export default Search;
|
||||
export default Search
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import React from 'react'
|
||||
|
||||
const SearchRow = ({ description, category, location, date, query }) => {
|
||||
function getHighlightedText(text, highlight) {
|
||||
function getHighlightedText (text, highlight) {
|
||||
// Split text on highlight term, include term itself into parts, ignore case
|
||||
const parts = text.split(new RegExp(`(${highlight})`, 'gi'));
|
||||
const parts = text.split(new RegExp(`(${highlight})`, 'gi'))
|
||||
return <span>{ parts.map(part => part.toLowerCase() === highlight.toLowerCase() ? <span style={{ backgroundColor: 'yellow', color: 'black' }}>{part}</span> : part) }</span>
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user