1
0
mirror of https://github.com/BoostIo/Boostnote synced 2025-12-14 18:26:26 +00:00

improve searchTextBox ux

This commit is contained in:
Sosuke Suzuki
2017-06-11 15:42:07 +09:00
parent 48ca13f82c
commit 29e0d121cd

View File

@@ -203,6 +203,7 @@ class NoteList extends React.Component {
getNotes () { getNotes () {
let { data, params, location } = this.props let { data, params, location } = this.props
let { router } = this.context
if (location.pathname.match(/\/home/)) { if (location.pathname.match(/\/home/)) {
return data.noteMap.map((note) => note) return data.noteMap.map((note) => note)
@@ -214,7 +215,11 @@ class NoteList extends React.Component {
} }
if (location.pathname.match(/\/searched/)) { if (location.pathname.match(/\/searched/)) {
return searchFromNotes(this.props.data, document.getElementsByClassName('searchInput')[0].value) const searchInputText = document.getElementsByClassName('searchInput')[0].value
if (searchInputText === '') {
router.push('/home')
}
return searchFromNotes(this.props.data, searchInputText)
} }
let storageKey = params.storageKey let storageKey = params.storageKey