UNPKG

bananas-commerce-admin

Version:

What's this, an admin for apes?

37 lines (36 loc) 1.19 kB
import React from "react"; import { PathMatch } from "react-router-dom"; export interface RouteInfo { id: string; app: string; view: string; action: string; title: string; /** Whether this route should be used for navigation in the router context */ navigation: boolean; path: string; page: string; } export type RouterParams = Record<string, string | number | boolean>; export type RouterQuery = string | URLSearchParams | string[][] | Record<string, string>; interface RouterContext { routes: RouteInfo[]; getCurrent(): { route: RouteInfo; match: PathMatch; } | undefined; getRoute(reverse: string): RouteInfo | undefined; setCustomRoutes(routes: RouteInfo[]): void; navigate(route?: number | string | RouteInfo, options?: { params?: RouterParams; query?: RouterQuery; replace?: boolean; }): void; } declare const RouterContext: React.Context<RouterContext>; export declare const useRouter: () => RouterContext; export declare const RouterContextProvider: React.FC<React.PropsWithChildren<{ stripPathPrefix?: string; basename?: string; }>>; export default RouterContext;