breadcrumbContextProvider.tsx 653 B

123456789101112131415161718192021222324252627
  1. import {InjectedRouter, PlainRoute} from 'react-router';
  2. import {RouteContext} from 'sentry/views/routeContext';
  3. import {BreadcrumbProvider} from 'sentry/views/settings/components/settingsBreadcrumb/context';
  4. export function BreadcrumbContextProvider({
  5. children,
  6. router = TestStubs.router(),
  7. routes = [],
  8. }: {
  9. children: React.ReactNode;
  10. router?: InjectedRouter;
  11. routes?: PlainRoute[];
  12. }) {
  13. return (
  14. <RouteContext.Provider
  15. value={{
  16. router,
  17. location: router.location,
  18. params: {},
  19. routes,
  20. }}
  21. >
  22. <BreadcrumbProvider>{children}</BreadcrumbProvider>
  23. </RouteContext.Provider>
  24. );
  25. }