mirror of
https://github.com/BoostIo/Boostnote
synced 2025-12-13 09:46:22 +00:00
51 lines
1.5 KiB
JavaScript
51 lines
1.5 KiB
JavaScript
import React, { PropTypes } from 'react'
|
|
import ReactDOM from 'react-dom'
|
|
import ExternalLink from 'boost/components/ExternalLink'
|
|
import { setSearchFilter } from 'boost/actions'
|
|
|
|
export default class ArticleTopBar extends React.Component {
|
|
handleSearchChange (e) {
|
|
let { dispatch } = this.props
|
|
|
|
dispatch(setSearchFilter(e.target.value))
|
|
}
|
|
handleSearchClearButton (e) {
|
|
let { dispatch } = this.props
|
|
|
|
dispatch(setSearchFilter(''))
|
|
ReactDOM.findDOMNode(this.refs.searchInput).focus()
|
|
}
|
|
|
|
render () {
|
|
return (
|
|
<div className='ArticleTopBar'>
|
|
<div className='left'>
|
|
<div className='search'>
|
|
<i className='fa fa-search fa-fw' />
|
|
<input ref='searchInput' value={this.props.status.search} onChange={e => this.handleSearchChange(e)} placeholder='Search' type='text'/>
|
|
{
|
|
this.props.status.search != null && this.props.status.search.length > 0
|
|
? <button onClick={e => this.handleSearchClearButton(e)} className='searchClearBtn'><i className='fa fa-times'/></button>
|
|
: null
|
|
}
|
|
</div>
|
|
</div>
|
|
<div className='right'>
|
|
<button>?</button>
|
|
<ExternalLink className='logo' href='http://b00st.io'>
|
|
<img src='../../resources/favicon-230x230.png' width='44' height='44'/>
|
|
</ExternalLink>
|
|
</div>
|
|
</div>
|
|
)
|
|
}
|
|
}
|
|
|
|
ArticleTopBar.propTypes = {
|
|
search: PropTypes.string,
|
|
dispatch: PropTypes.func,
|
|
status: PropTypes.shape({
|
|
search: PropTypes.string
|
|
})
|
|
}
|