feat(search): enable configuration of the Search component via instrumented config

Signed-off-by: Enrico Alvarenga <enricomalvarenga@gmail.com>
This commit is contained in:
Enrico Alvarenga
2023-06-22 12:57:49 -07:00
committed by Camila Belo
parent c48221c36a
commit be6250a958
6 changed files with 69 additions and 6 deletions
@@ -95,16 +95,27 @@ export const useSearchContextCheck = () => {
};
/**
* The initial state of `SearchContextProvider`.
* @public
*
* Constructs an object representing the initial state default
* configuration for the SearchPage component
*
* @returns {SearchContextState}
*/
const searchInitialState: SearchContextState = {
export const getSearchContextInitialStateDefaults = (): SearchContextState => ({
term: '',
types: [],
filters: {},
pageLimit: undefined,
pageCursor: undefined,
};
});
/**
* The initial state of `SearchContextProvider`.
*
*/
const searchInitialState: SearchContextState =
getSearchContextInitialStateDefaults();
const useSearchContextValue = (
initialValue: SearchContextState = searchInitialState,
@@ -18,6 +18,7 @@ export {
SearchContextProvider,
useSearch,
useSearchContextCheck,
getSearchContextInitialStateDefaults,
} from './SearchContext';
export type {
+1
View File
@@ -28,6 +28,7 @@ export {
SearchContextProvider,
useSearch,
useSearchContextCheck,
getSearchContextInitialStateDefaults,
} from './context';
export type {
SearchContextProviderProps,