Skip to content

Commit 13ded26

Browse files
authored
Merge pull request #10 from nturbanov/main
Add support for post status in PostSearchControl
2 parents 5a7605e + afad21f commit 13ded26

File tree

7 files changed

+10
-6
lines changed

7 files changed

+10
-6
lines changed

build/index.asset.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '7770246f87332afbd53d');
1+
<?php return array('dependencies' => array('react', 'react-dom', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '1ba548a08c2d3504c91a');

build/index.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export const TaxonomyControl: React.FC<{
3737

3838
export const PostSearchControl: React.FC<{
3939
type: string;
40+
status: string;
4041
value: number;
4142
onChange: (...args: any[]) => any;
4243
placeholder: string;

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@evermade/wp-block-toolkit",
3-
"version": "5.0.1",
3+
"version": "5.0.2",
44
"description": "Toolkit for developing WordPress Gutenberg blocks.",
55
"main": "build/index.js",
66
"repository": {

src/components/PostSearchControl.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const SEARCH_MINIMUM_LENGTH = 3;
2828

2929
const PostSearchControl = ({
3030
type = "post",
31+
status = "publish",
3132
value = 0,
3233
onChange,
3334
placeholder = __("Search", textdomain),
@@ -47,6 +48,7 @@ const PostSearchControl = ({
4748

4849
const posts = usePostSearch({
4950
postType: type,
51+
postStatus: status,
5052
search: debouncedSearch,
5153
minimumLength: SEARCH_MINIMUM_LENGTH,
5254
perPage,

src/hooks/use-post-search.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useSelect } from "@wordpress/data";
55

66
export function usePostSearch({
77
postType = "post",
8+
postStatus = "publish",
89
search = "",
910
minimumLength = 3,
1011
perPage = 20,
@@ -19,7 +20,7 @@ export function usePostSearch({
1920
per_page: perPage,
2021
orderby: "title",
2122
order: "asc",
22-
status: "publish",
23+
status: postStatus,
2324
search,
2425
});
2526
},

0 commit comments

Comments
 (0)