import type { ReactNode } from "react";
import { ThemeProvider } from "@mui/material/styles";
import { LocalizationProvider } from "@mui/x-date-pickers/LocalizationProvider";
import { AdapterDateFns } from "@mui/x-date-pickers/AdapterDateFns";
import { cs } from "date-fns/locale";
import { theme } from "../theme";
import AppGlobalStyles from "../GlobalStyles";

export default function MuiProvider({ children }: { children: ReactNode }) {
  return (
    <ThemeProvider theme={theme} defaultMode="dark">
      <AppGlobalStyles />
      <LocalizationProvider dateAdapter={AdapterDateFns} adapterLocale={cs}>
        {children}
      </LocalizationProvider>
    </ThemeProvider>
  );
}
