Skip to content

Commit

Permalink
Merge pull request #7 from WebDevStudios/feature/debounce-input-field
Browse files Browse the repository at this point in the history
Added debounce to input
  • Loading branch information
coreymcollins committed Nov 29, 2018
2 parents e6f0e88 + d1d732f commit f250fd9
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 14 deletions.
3 changes: 2 additions & 1 deletion assets/js/components/searchForm.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import qs from 'query-string';
import { DebounceInput } from 'react-debounce-input';
import SearchResults from './searchResults';

export default class SearchForm extends React.Component {
Expand Down Expand Up @@ -98,7 +99,7 @@ export default class SearchForm extends React.Component {
render() {
return (
<div className={ `${ this.getFormClass() }` }>
<input className="search-input" type="text" onChange={ this.getResults } placeholder={ wds_react_post_search.placeholder_text } />
<DebounceInput debounceTimeout={ 300 } className="search-input" type="text" onChange={ this.getResults } placeholder={ wds_react_post_search.placeholder_text } />
<SearchResults searched={ this.state.searched } loading={ this.state.loading } results={ this.state.results } lengthError={ this.state.lengthError } empty={ this.state.empty } />
</div>
)
Expand Down
10 changes: 5 additions & 5 deletions assets/js/public.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion class-wds-react-post-search.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: WDS React Post Search
* Description: Power up the basic WordPress search with React.
* Plugin URI: https://www.webdevstudios.com
* Version: 1.0.3
* Version: 1.0.4
*
* With help from:
* https://www.ibenic.com/wordpress-react-search/
Expand Down
28 changes: 23 additions & 5 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wds-react-post-search",
"version": "1.0.3",
"version": "1.0.4",
"description": "Power up the basic WordPress search field with React.",
"main": "assets/js/public.js",
"dependencies": {
Expand All @@ -12,7 +12,8 @@
"install": "^0.12.2",
"npm": "^6.4.1",
"query-string": "^6.2.0",
"react": "^16.5.2",
"react": "^16.6.3",
"react-debounce-input": "^3.2.0",
"react-dom": "^16.5.2",
"webpack": "^4.21.0"
},
Expand Down

0 comments on commit f250fd9

Please sign in to comment.