import { createTheme, ThemeProvider } from '@mui/material';
import { ThemeProviderProps } from "@mui/material/styles/ThemeProvider";
import React from 'react';
import { newOlosPalette } from '../helpers';

export const NormaProvider = (props: ThemeProviderProps) => {
  const { theme, children } = props;

  const getTheme = () => {
    if (theme) return theme;
    return createTheme({
      palette: newOlosPalette,
    });
  };

  const appTheme = getTheme();

  return (
    <ThemeProvider theme={appTheme}>
      {children}
    </ThemeProvider>
  );
};
