feat(search): enable configuration of the Search component via instrumented config
Signed-off-by: Enrico Alvarenga <enricomalvarenga@gmail.com>
This commit is contained in:
committed by
Camila Belo
parent
c48221c36a
commit
be6250a958
@@ -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 {
|
||||
|
||||
@@ -28,6 +28,7 @@ export {
|
||||
SearchContextProvider,
|
||||
useSearch,
|
||||
useSearchContextCheck,
|
||||
getSearchContextInitialStateDefaults,
|
||||
} from './context';
|
||||
export type {
|
||||
SearchContextProviderProps,
|
||||
|
||||
Reference in New Issue
Block a user