Only push onBlur if props available

This commit is contained in:
James Barnsley
2019-06-10 14:00:05 +12:00
parent bd811ff007
commit c04ed1862d
7 changed files with 8 additions and 10 deletions

View File

@ -55,7 +55,7 @@ class SearchForm extends React.Component{
type="text"
placeholder={this.props.term ? this.props.term : "Search..."}
onChange={e => this.setState({term: e.target.value})}
onBlur={e => this.props.onBlur(this.state.term)}
onBlur={e => (this.props.onBlur !== undefined ? this.props.onBlur(this.state.term) : null)}
value={ this.state.term }
/>
</label>

View File

@ -396,7 +396,6 @@ class Search extends React.Component{
<SearchForm
history={this.props.history}
term={this.state.term}
//onBlur={term => this.setState({term: term})}
onSubmit={term => this.handleSubmit(term)}
/>

View File

@ -201,7 +201,7 @@ h2 {
font-weight: 400;
font-size: 2rem;
line-height: 2.2rem;
letter-spacing: -0.15rem;
letter-spacing: -0.08rem;
a {
color: inherit;