mirror of
https://github.com/bellingcat/ukraine-timemap.git
synced 2026-06-12 13:28:36 +03:00
lint jsx files
This commit is contained in:
@@ -1,40 +1,41 @@
|
||||
import React from 'react';
|
||||
import copy from '../js/data/copy.json';
|
||||
import TagFilter from './TagFilter.jsx';
|
||||
/* global fetch */
|
||||
import React from 'react'
|
||||
import copy from '../js/data/copy.json'
|
||||
import TagFilter from './TagFilter.jsx'
|
||||
|
||||
export default class Search extends React.Component {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
constructor (props) {
|
||||
super(props)
|
||||
this.state = {
|
||||
searchValue: undefined,
|
||||
searchResults: []
|
||||
}
|
||||
|
||||
this.handleSearchChange = this.handleSearchChange.bind(this);
|
||||
this.handleSearchSubmit = this.handleSearchSubmit.bind(this);
|
||||
this.handleSearchChange = this.handleSearchChange.bind(this)
|
||||
this.handleSearchSubmit = this.handleSearchSubmit.bind(this)
|
||||
}
|
||||
|
||||
handleSearchSubmit(e) {
|
||||
e.preventDefault();
|
||||
handleSearchSubmit (e) {
|
||||
e.preventDefault()
|
||||
fetch(`api/search/${this.state.searchValue}`)
|
||||
.then(response => response.json())
|
||||
.then(json => {
|
||||
this.setState({
|
||||
searchResults: json.tags
|
||||
})
|
||||
});
|
||||
})
|
||||
}
|
||||
|
||||
handleSearchChange(event) {
|
||||
this.setState({ searchValue: event.target.value });
|
||||
handleSearchChange (event) {
|
||||
this.setState({ searchValue: event.target.value })
|
||||
}
|
||||
|
||||
renderSearchResults() {
|
||||
renderSearchResults () {
|
||||
return (
|
||||
this.state.searchResults.map(tag => {
|
||||
return (
|
||||
<TagFilter
|
||||
isShowTree={true}
|
||||
isShowTree
|
||||
tags={this.props.tags}
|
||||
categories={this.props.categories}
|
||||
tagFilters={this.props.tagFilters}
|
||||
@@ -43,22 +44,22 @@ export default class Search extends React.Component {
|
||||
tag={tag}
|
||||
isCategory={this.props.isCategory}
|
||||
/>
|
||||
);
|
||||
)
|
||||
})
|
||||
);
|
||||
)
|
||||
}
|
||||
|
||||
render() {
|
||||
render () {
|
||||
return (
|
||||
<div className="search-content">
|
||||
<div className='search-content'>
|
||||
<h2>{copy[this.props.language].toolbar.panels.search.title}</h2>
|
||||
<form onSubmit={this.handleSearchSubmit}>
|
||||
<input
|
||||
value={this.state.searchValue}
|
||||
onChange={this.handleSearchChange}
|
||||
autoFocus
|
||||
type="text"
|
||||
name="search-input"
|
||||
type='text'
|
||||
name='search-input'
|
||||
placeholder={copy[this.props.language].toolbar.panels.search.placeholder}
|
||||
/>
|
||||
</form>
|
||||
@@ -66,6 +67,6 @@ export default class Search extends React.Component {
|
||||
{this.renderSearchResults()}
|
||||
</ul>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user