default placeholder

This commit is contained in:
Cássio Zen 2016-07-07 17:02:00 -03:00
parent 26a51807f6
commit 64ab7937e9

View File

@ -7,6 +7,7 @@ import { Icon } from '../components/UI';
import styles from './FindBar.css'; import styles from './FindBar.css';
const SEARCH = 'SEARCH'; const SEARCH = 'SEARCH';
const PLACEHOLDER = 'Type to search or execute commands';
class FindBar extends Component { class FindBar extends Component {
constructor(props) { constructor(props) {
@ -15,7 +16,7 @@ class FindBar extends Component {
this._searchCommand = { search: true, regexp:`(?:${SEARCH})?(.*)`, param:{ name:'searchTerm', display:'' } }; this._searchCommand = { search: true, regexp:`(?:${SEARCH})?(.*)`, param:{ name:'searchTerm', display:'' } };
this.state = { this.state = {
value: '', value: '',
placeholder: '', placeholder: PLACEHOLDER,
activeScope: null, activeScope: null,
isOpen: false, isOpen: false,
highlightedIndex: 0, highlightedIndex: 0,
@ -98,7 +99,8 @@ class FindBar extends Component {
if (command.search) { if (command.search) {
this.setState({ this.setState({
activeScope: SEARCH activeScope: SEARCH,
placeholder: ''
}); });
this.props.dispatch(runCommand('search', { searchTerm: enteredParamValue })); this.props.dispatch(runCommand('search', { searchTerm: enteredParamValue }));
} else if (command.param && !enteredParamValue) { } else if (command.param && !enteredParamValue) {
@ -123,7 +125,7 @@ class FindBar extends Component {
if (this.state.value.length === 0 && this.state.activeScope) { if (this.state.value.length === 0 && this.state.activeScope) {
this.setState({ this.setState({
activeScope: null, activeScope: null,
placeholder: '' placeholder: PLACEHOLDER
}); });
} }
} }