providers.tsx 795 B

12345678910111213141516171819202122232425262728293031
  1. "use client";
  2. import type { ThemeProviderProps } from "next-themes";
  3. import * as React from "react";
  4. import { HeroUIProvider } from "@heroui/system";
  5. import { useRouter } from "next/navigation";
  6. import { ThemeProvider as NextThemesProvider } from "next-themes";
  7. export interface ProvidersProps {
  8. children: React.ReactNode;
  9. themeProps?: ThemeProviderProps;
  10. }
  11. declare module "@react-types/shared" {
  12. interface RouterConfig {
  13. routerOptions: NonNullable<
  14. Parameters<ReturnType<typeof useRouter>["push"]>[1]
  15. >;
  16. }
  17. }
  18. export function Providers({ children, themeProps }: ProvidersProps) {
  19. const router = useRouter();
  20. return (
  21. <HeroUIProvider navigate={router.push}>
  22. <NextThemesProvider {...themeProps}>{children}</NextThemesProvider>
  23. </HeroUIProvider>
  24. );
  25. }