// src/theme/index.js
'use client';
import PropTypes from 'prop-types';
import { useMemo } from 'react';
import CssBaseline from '@mui/material/CssBaseline';
import { createTheme, ThemeProvider as MuiThemeProvider } from '@mui/material/styles';
import { palette } from './palette';
import { shadows } from './shadows';
import { typography } from './typography';
import { customShadows } from './custom-shadows';
import { componentsOverrides } from './overrides';
import NextAppDirEmotionCacheProvider from './next-emotion-cache';
export default function ThemeProvider({ children }) {
const memoizedValue = useMemo(
() => ({
palette: palette('light'), // or palette('dark')
shadows: shadows('light'), // or shadows('dark')
customShadows: customShadows('light'), // or customShadows('dark')
shape: { borderRadius: 8 },
typography,
}),
[]
);
const theme = createTheme(memoizedValue);
theme.components = componentsOverrides(theme);
return (
<NextAppDirEmotionCacheProvider options={{ key: 'css' }}>
<MuiThemeProvider theme={theme}>
<CssBaseline />
{children}
</MuiThemeProvider>
</NextAppDirEmotionCacheProvider>
);
}
ThemeProvider.propTypes = {
children: PropTypes.node,
};