This commit is contained in:
Chen-I Lim 2020-10-08 20:20:02 -07:00
parent 66e59d3029
commit c98ae89b50
2 changed files with 7 additions and 3 deletions

View file

@ -101,7 +101,12 @@ class BoardComponent extends React.Component<Props, State> {
<div className={hasFilter ? "octo-button active" : "octo-button"} onClick={(e) => { this.filterClicked(e) }}>Filter</div>
<div className={hasSort ? "octo-button active" : "octo-button"} onClick={(e) => { this.sortClicked(e) }}>Sort</div>
{this.state.isSearching
? <Editable ref={this.searchFieldRef} text={boardTree.getSearchText()} placeholderText="Search text" onChanged={(text) => { this.searchChanged(text) }} onKeyDown={(e) => { this.onSearchKeyDown(e) }}></Editable>
? <Editable
ref={this.searchFieldRef}
text={boardTree.getSearchText()}
placeholderText="Search text"
onChanged={(text) => { this.searchChanged(text) }}
onKeyDown={(e) => { this.onSearchKeyDown(e) }}></Editable>
: <div className="octo-button" onClick={() => { this.setState({ ...this.state, isSearching: true }) }}>Search</div>
}
<div className="octo-button" onClick={(e) => { this.optionsClicked(e) }}><div className="imageOptions" /></div>
@ -398,7 +403,7 @@ class BoardComponent extends React.Component<Props, State> {
onSearchKeyDown(e: React.KeyboardEvent) {
if (e.keyCode === 27) { // ESC: Clear search
this.searchFieldRef.current.text = ""
this.setState({...this.state, isSearching: false})
this.setState({ ...this.state, isSearching: false })
this.props.pageController.setSearchText(undefined)
e.preventDefault()
}

View file

@ -102,7 +102,6 @@ class Editable extends React.Component<Props, State> {
this.text = newText
this.elementRef.current.classList.remove("active")
if (onBlur) { onBlur() }
}}