Add maxResults to Search component
parent
dba6d60a08
commit
510d4b30fd
|
@ -54,6 +54,8 @@ export default class Search extends React.Component {
|
||||||
results = this.index.search(this.tokenize(value)).map((result) =>
|
results = this.index.search(this.tokenize(value)).map((result) =>
|
||||||
result.ref
|
result.ref
|
||||||
)
|
)
|
||||||
|
|
||||||
|
results = results.slice(0, this.props.maxResults)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.props.onSearch(results)
|
this.props.onSearch(results)
|
||||||
|
@ -76,8 +78,10 @@ export default class Search extends React.Component {
|
||||||
|
|
||||||
Search.propTypes = {
|
Search.propTypes = {
|
||||||
onSearch: React.PropTypes.func,
|
onSearch: React.PropTypes.func,
|
||||||
|
maxResults: React.PropTypes.number,
|
||||||
}
|
}
|
||||||
|
|
||||||
Search.defaultProps = {
|
Search.defaultProps = {
|
||||||
onSearch: (() => {}),
|
onSearch: (() => {}),
|
||||||
|
maxResults: 75,
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue