emoji-mart-lazyload/src/components/search.js

36 lines
655 B
JavaScript
Raw Normal View History

2016-05-31 18:39:30 +00:00
import React from 'react'
import {emojiIndex} from '../utils'
2016-05-31 18:39:30 +00:00
export default class Search extends React.Component {
handleChange() {
var { input } = this.refs,
value = input.value
2016-05-31 18:39:30 +00:00
this.props.onSearch(emojiIndex.search(value))
2016-05-31 18:39:30 +00:00
}
clear() {
this.refs.input.value = ''
}
2016-05-31 18:39:30 +00:00
render() {
return <input
ref='input'
type='text'
onChange={this.handleChange.bind(this)}
placeholder='Search'
className='emoji-picker-search'
/>
}
}
Search.propTypes = {
onSearch: React.PropTypes.func,
2016-07-08 21:05:26 +00:00
maxResults: React.PropTypes.number,
2016-05-31 18:39:30 +00:00
}
Search.defaultProps = {
onSearch: (() => {}),
2016-07-08 21:05:26 +00:00
maxResults: 75,
2016-05-31 18:39:30 +00:00
}