2018-07-09 08:22:48 +00:00
|
|
|
import React from 'react';
|
|
|
|
import { PropTypes } from 'prop-types';
|
|
|
|
import './style.scss';
|
|
|
|
|
|
|
|
const SearchBar = props => (
|
|
|
|
<div className="search-bar">
|
|
|
|
<div className="container">
|
|
|
|
<h3>Browse Archives</h3>
|
2018-07-09 14:29:57 +00:00
|
|
|
<form className="search-form">
|
|
|
|
<input
|
|
|
|
className="search-input"
|
|
|
|
type="search"
|
|
|
|
placeholder="Search archives"
|
|
|
|
value={props.term}
|
|
|
|
onChange={props.onSearchInputChange}
|
|
|
|
/>
|
|
|
|
{ props.isSearchActive && (
|
|
|
|
// eslint-disable-next-line
|
|
|
|
<span
|
|
|
|
className="search-clear-button"
|
|
|
|
onClick={props.clearSearchInput}
|
|
|
|
>
|
|
|
|
Clear search
|
|
|
|
</span>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
</form>
|
2018-07-09 08:22:48 +00:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
|
|
|
SearchBar.propTypes = {
|
|
|
|
term: PropTypes.string.isRequired,
|
2018-07-09 14:29:57 +00:00
|
|
|
isSearchActive: PropTypes.bool.isRequired,
|
|
|
|
onSearchInputChange: PropTypes.func.isRequired,
|
|
|
|
clearSearchInput: PropTypes.func.isRequired,
|
|
|
|
};
|
2018-07-09 08:22:48 +00:00
|
|
|
|
|
|
|
export default SearchBar;
|