import { ReactNode } from 'react';

import { ThemeProvider } from '@material-hu/mui/styles';

import { useSettings } from 'src/contexts/SettingsContext';
import { createThemeConfig } from 'src/theme';

type ThemeWrapperProps = {
  children: ReactNode;
};

const ThemeWrapper = ({ children }: ThemeWrapperProps) => {
  const { settings } = useSettings();
  const theme = createThemeConfig(settings);

  return <ThemeProvider theme={theme}>{children}</ThemeProvider>;
};

export default ThemeWrapper;
