@squonk/mui-theme
v3.0.2
Published
MUI theme used on Squonk products
Downloads
1,095
Readme
Material-UI themes for Squonk applications. Can be used independently with just Material-UI or with Emotion of Styled-Components.
Examples
Material UI
The correct theme for a user can be automatically set with prefers-color-scheme
.
import React from 'react';
import { CssBaseline, useMediaQuery } from '@material-ui/core';
import { StylesProvider, ThemeProvider as MuiThemeProvider } from '@material-ui/core/styles';
import { darkTheme, lightTheme } from '@squonk/mui-theme';
export const App = () => {
const prefersDarkMode = useMediaQuery('(prefers-color-scheme: dark)');
const theme = prefersDarkMode ? darkTheme : lightTheme;
return (
<StylesProvider injectFirst>
<CssBaseline />
<MuiThemeProvider theme={theme}>
{...}
</MuiThemeProvider>
</StylesProvider>
);
};
Emotion
Wrap the previous example with the theme provider from emotion.
import { ThemeProvider } from '@emotion/react';
<ThemeProvider theme={theme}>{...}</ThemeProvider>
Styled Components
import { ThemeProvider } from 'styled-components';
<ThemeProvider theme={theme}>{...}</ThemeProvider>
Publishing a new Version
With made changes committed and pushed:
- Run
pnpm release
. This builds adist
with thepublishConfig
merged in.