2017-05-12 00:23:56 +00:00
|
|
|
// @flow
|
2017-05-22 06:02:53 +00:00
|
|
|
import React, { Component } from 'react';
|
2016-07-19 07:30:47 +00:00
|
|
|
import styles from './SearchField.scss';
|
|
|
|
|
2017-05-22 06:02:53 +00:00
|
|
|
class SearchField extends Component {
|
|
|
|
props: {
|
|
|
|
onChange: Function,
|
2017-04-28 04:48:13 +00:00
|
|
|
};
|
2016-07-19 07:30:47 +00:00
|
|
|
|
2017-05-26 07:04:13 +00:00
|
|
|
handleChange = (ev: SyntheticEvent) => {
|
|
|
|
this.props.onChange(ev.currentTarget.value ? ev.currentTarget.value : '');
|
2017-04-28 04:48:13 +00:00
|
|
|
};
|
2016-07-19 07:30:47 +00:00
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
2017-04-28 04:48:13 +00:00
|
|
|
<div className={styles.container}>
|
2016-07-19 07:30:47 +00:00
|
|
|
<input
|
2017-05-22 06:02:53 +00:00
|
|
|
{...this.props}
|
|
|
|
onChange={this.handleChange}
|
2017-04-28 04:48:13 +00:00
|
|
|
className={styles.field}
|
2016-07-19 07:30:47 +00:00
|
|
|
placeholder="Search"
|
|
|
|
autoFocus
|
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default SearchField;
|