pagamio-frontend-commons-lib
Version:
Pagamio library for Frontend reusable components like the form engine and table container
37 lines (36 loc) • 1.36 kB
TypeScript
import type { FC, PropsWithChildren } from 'react';
import type { AppSidebarPageItem } from './SidebarContext';
interface AppBreadcrumb {
label: string;
path: string;
key?: string;
}
interface AppBreadcrumbContextType {
breadcrumbs: AppBreadcrumb[];
pathname: string;
updateBreadcrumb: (key: string, newLabel: string) => void;
rootPageIcon: FC | undefined;
}
interface AppBreadcrumbProviderProps extends PropsWithChildren {
pathname: string;
pages: AppSidebarPageItem[];
}
/**
* Provider component for the BreadcrumbContext.
* Manages the state and logic for breadcrumbs based on the current pathname.
*
* @param children - The child components to be wrapped by the provider.
* @param pathname - The pathname of the current app route.
* @param pages - The app root pages of the sidebar
*/
declare const AppBreadcrumbProvider: ({ children, pathname, pages }: AppBreadcrumbProviderProps) => import("react/jsx-runtime").JSX.Element;
/**
* Hook to access the BreadcrumbContext.
* Provides access to breadcrumbs, the update function, and the root page icon.
*
* @throws Will throw an error if used outside a BreadcrumbProvider.
*/
declare const useAppBreadcrumbs: () => AppBreadcrumbContextType;
export default AppBreadcrumbProvider;
export { useAppBreadcrumbs };
export type { AppBreadcrumbContextType, AppBreadcrumb };