From edfddcc75fd45700f9f1e72230a77feb13ec5975 Mon Sep 17 00:00:00 2001 From: Andrew Nicolaou Date: Sun, 20 Oct 2019 21:58:13 +0200 Subject: [PATCH] Export unconnected Searchbar for use elsewhere (with sketch search) --- client/modules/IDE/components/Searchbar.jsx | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/client/modules/IDE/components/Searchbar.jsx b/client/modules/IDE/components/Searchbar.jsx index 771bdf82..02de9e1b 100644 --- a/client/modules/IDE/components/Searchbar.jsx +++ b/client/modules/IDE/components/Searchbar.jsx @@ -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