breadcrumbContextProvider.tsx 715 B

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