Export unconnected Searchbar for use elsewhere (with sketch search)

This commit is contained in:
Andrew Nicolaou 2019-10-20 21:58:13 +02:00
parent 3554fe9eb4
commit edfddcc75f

View file

@ -8,7 +8,7 @@ import * as SortingActions from '../actions/sorting';
const searchIcon = require('../../../images/magnifyingglass.svg');
class Searchbar extends React.Component {
export class Searchbar extends React.Component {
constructor(props) {
super(props);
this.state = {
@ -58,7 +58,7 @@ class Searchbar extends React.Component {
className="searchbar__input"
type="text"
value={searchValue}
placeholder="Search sketches..."
placeholder={this.props.searchLabel}
onChange={this.handleSearchChange}
onKeyUp={this.handleSearchEnter}
/>
@ -75,9 +75,15 @@ class Searchbar extends React.Component {
Searchbar.propTypes = {
searchTerm: PropTypes.string.isRequired,
setSearchTerm: PropTypes.func.isRequired,
resetSearchTerm: PropTypes.func.isRequired
resetSearchTerm: PropTypes.func.isRequired,
searchLabel: PropTypes.string,
};
Searchbar.defaultProps = {
searchLabel: 'Search sketches...',
};
function mapStateToProps(state) {
return {
searchTerm: state.search.searchTerm