Skip to content

Commit cab819f

Browse files
Merge pull request #46 from devgateway/add-year-range-api
2 parents 13812c2 + 6277b4e commit cab819f

File tree

8 files changed

+24
-9
lines changed

8 files changed

+24
-9
lines changed

wp-react-lib/src/consumers/CategoriesConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface CategoriesConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `CategoriesContext.Consumer` instead.
9+
* @deprecated Use the `CategoriesContext.Consumer` instead if you want type safety.
1010
* CategoriesConsumer is a component that provides the categories, loading, error, and meta to its children.
1111
* @param props - The props for the CategoriesConsumer component.
1212
* @returns The CategoriesConsumer component.

wp-react-lib/src/consumers/MediaConsumer.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,16 @@
11
import React from 'react'
22
import { MediaContext } from '../providers/MediaProvider'
3-
import type { Media } from '../types';
43

54
interface MediaConsumerProps {
65
children: React.ReactNode | React.ReactNode[] | React.ReactElement | React.ReactElement[];
76
}
87

8+
/**
9+
* @deprecated Use the `MediaContext.Consumer` instead if you want type safety.
10+
* MediaConsumer is a component that provides the media, locale to its children.
11+
* @param props - The props for the MediaConsumer component.
12+
* @returns The MediaConsumer component.
13+
*/
914
const MediaConsumer = (props: MediaConsumerProps) => {
1015
return (
1116
<MediaContext.Consumer>

wp-react-lib/src/consumers/PageConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface PageConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `PageContext.Consumer` instead.
9+
* @deprecated Use the `PageContext.Consumer` instead if you want type safety.
1010
* PageConsumer is a component that provides the pages, meta, and locale to its children.
1111
* @param props - The props for the PageConsumer component.
1212
* @returns The PageConsumer component.

wp-react-lib/src/consumers/PostConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface PostConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `PostContext.Consumer` instead.
9+
* @deprecated Use the `PostContext.Consumer` instead if you want type safety.
1010
* PostConsumer is a component that provides the posts, meta, and locale to its children.
1111
* @param props - The props for the PostConsumer component.
1212
* @returns The PostConsumer component.

wp-react-lib/src/consumers/SearchConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface SearchConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `SearchContext.Consumer` instead.
9+
* @deprecated Use the `SearchContext.Consumer` instead if you want type safety.
1010
* SearchConsumer is a component that provides the search results, meta, and locale to its children.
1111
* @param props - The props for the SearchConsumer component.
1212
* @returns The SearchConsumer component.

wp-react-lib/src/consumers/SettingsConsumer.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interface SettingsConsumerProps {
66
}
77

88
/**
9-
* @deprecated Use the `SettingsContext.Consumer` instead.
9+
* @deprecated Use the `SettingsContext.Consumer` instead if you want type safety.
1010
* SettingsConsumer is a component that provides the settings to its children.
1111
* @param props - The props for the SettingsConsumer component.
1212
* @returns The SettingsConsumer component.

wp-react-lib/src/consumers/TaxonomyConsumer.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ interface TaxonomyConsumerProps {
55
children: React.ReactNode | React.ReactNode[] | React.ReactElement | React.ReactElement[];
66
}
77

8+
/**
9+
* @deprecated Use the `TaxonomyContext.Consumer` instead if you want type safety.
10+
* TaxonomyConsumer is a component that provides the taxonomies, locale to its children.
11+
* @param props - The props for the TaxonomyConsumer component.
12+
* @returns The TaxonomyConsumer component.
13+
*/
814
const TaxonomyConsumer = (props: TaxonomyConsumerProps) => {
915
return (
1016
<TaxonomyContext.Consumer>

wp-react-lib/src/hooks/posts.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface UsePostsProps {
1717
previewNonce?: string;
1818
previewId?: string;
1919
search?: string;
20+
after?: string;
2021
}
2122

2223
interface UsePostsReturn {
@@ -51,7 +52,8 @@ export const usePosts = (props: UsePostsProps): UsePostsReturn => {
5152
locale,
5253
previewNonce,
5354
previewId,
54-
search
55+
search,
56+
after
5557
} = props;
5658

5759
const dispatch = useDispatch() as any; // Type assertion to handle thunk actions
@@ -85,7 +87,8 @@ export const usePosts = (props: UsePostsProps): UsePostsReturn => {
8587
locale,
8688
previewNonce,
8789
previewId,
88-
search
90+
search,
91+
after
8992
}));
9093
}
9194
}, [categories, locale, slug, taxonomy, page, perPage, search, dispatch, type, before, fields, store, previewNonce, previewId]);
@@ -104,7 +107,8 @@ export const usePosts = (props: UsePostsProps): UsePostsReturn => {
104107
locale,
105108
previewNonce,
106109
previewId,
107-
search
110+
search,
111+
after
108112
}));
109113
}, []);
110114

0 commit comments

Comments
 (0)