openfood/components/general/styling.tsx

23 lines
575 B
TypeScript
Raw Permalink Normal View History

2021-10-14 20:42:49 +02:00
import {FC, useMemo} from "react";
import {createTheme, CssBaseline, ThemeProvider, useMediaQuery} from "@mui/material";
export const Styling: FC = ({children}) => {
const prefersDarkMode = useMediaQuery("(prefers-color-scheme: dark)");
const theme = useMemo(
() =>
createTheme({
palette: {
mode: "dark",
},
}),
[prefersDarkMode]
);
return (
<ThemeProvider theme={theme}>
<CssBaseline/>
{children}
</ThemeProvider>
);
};