* ESC should go back from search using direct onKeyDown here as react-keydown does not trigger within an input * Addressable search urls
30 lines
604 B
JavaScript
30 lines
604 B
JavaScript
// @flow
|
|
import React, { Component } from 'react';
|
|
import styles from './SearchField.scss';
|
|
|
|
class SearchField extends Component {
|
|
props: {
|
|
onChange: Function,
|
|
};
|
|
|
|
handleChange = (event: SyntheticEvent) => {
|
|
event.currentTarget.value && this.props.onChange(event.currentTarget.value);
|
|
};
|
|
|
|
render() {
|
|
return (
|
|
<div className={styles.container}>
|
|
<input
|
|
{...this.props}
|
|
onChange={this.handleChange}
|
|
className={styles.field}
|
|
placeholder="Search"
|
|
autoFocus
|
|
/>
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default SearchField;
|