Export unconnected Searchbar for use elsewhere (with sketch search)
This commit is contained in:
parent
3554fe9eb4
commit
edfddcc75f
1 changed files with 9 additions and 3 deletions
|
@ -8,7 +8,7 @@ import * as SortingActions from '../actions/sorting';
|
||||||
|
|
||||||
const searchIcon = require('../../../images/magnifyingglass.svg');
|
const searchIcon = require('../../../images/magnifyingglass.svg');
|
||||||
|
|
||||||
class Searchbar extends React.Component {
|
export class Searchbar extends React.Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.state = {
|
this.state = {
|
||||||
|
@ -58,7 +58,7 @@ class Searchbar extends React.Component {
|
||||||
className="searchbar__input"
|
className="searchbar__input"
|
||||||
type="text"
|
type="text"
|
||||||
value={searchValue}
|
value={searchValue}
|
||||||
placeholder="Search sketches..."
|
placeholder={this.props.searchLabel}
|
||||||
onChange={this.handleSearchChange}
|
onChange={this.handleSearchChange}
|
||||||
onKeyUp={this.handleSearchEnter}
|
onKeyUp={this.handleSearchEnter}
|
||||||
/>
|
/>
|
||||||
|
@ -75,9 +75,15 @@ class Searchbar extends React.Component {
|
||||||
Searchbar.propTypes = {
|
Searchbar.propTypes = {
|
||||||
searchTerm: PropTypes.string.isRequired,
|
searchTerm: PropTypes.string.isRequired,
|
||||||
setSearchTerm: PropTypes.func.isRequired,
|
setSearchTerm: PropTypes.func.isRequired,
|
||||||
resetSearchTerm: PropTypes.func.isRequired
|
resetSearchTerm: PropTypes.func.isRequired,
|
||||||
|
searchLabel: PropTypes.string,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Searchbar.defaultProps = {
|
||||||
|
searchLabel: 'Search sketches...',
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
function mapStateToProps(state) {
|
function mapStateToProps(state) {
|
||||||
return {
|
return {
|
||||||
searchTerm: state.search.searchTerm
|
searchTerm: state.search.searchTerm
|
||||||
|
|
Loading…
Reference in a new issue