Skip to content

Commit 4c05cc4

Browse files
authored
Merge pull request #308 from humanmade/allow-more-term-results
Add a property to set search terms per page
2 parents 4cf22bf + 6b6ec65 commit 4c05cc4

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

  • src/components/TermSearchControl

src/components/TermSearchControl/index.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ const getTermIdByTermValue = ( terms, termValue ) => {
5252
* @param {object} props.taxonomy The taxonomy object.
5353
* @param {number[]} props.termIds An array with the block's term ids for the given taxonomy.
5454
* @param {Function} props.onChange Callback `onChange` function.
55+
* @param {number} props.perPage A number to use for the search terms per page.
5556
*
5657
* @returns {Element} The rendered component.
5758
*/
58-
function TermSearchControl( { label, taxonomy, termIds, onChange } ) {
59+
function TermSearchControl( { label, taxonomy, termIds, onChange, perPage = 20 } ) {
5960
const [ search, setSearch ] = useState( '' );
6061
const [ value, setValue ] = useState( EMPTY_ARRAY );
6162
const [ suggestions, setSuggestions ] = useState( EMPTY_ARRAY );
@@ -83,7 +84,7 @@ function TermSearchControl( { label, taxonomy, termIds, onChange } ) {
8384
search,
8485
orderby: 'name',
8586
exclude: termIds,
86-
per_page: 20,
87+
per_page: perPage,
8788
},
8889
];
8990
return {

0 commit comments

Comments
 (0)