-
-
Notifications
You must be signed in to change notification settings - Fork 32.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slide component throws error in Pigment project #43750
Comments
@ptpittman The workaround is to enable CSS variables: /** @type {import('next').NextConfig} */
import { withPigment } from '@pigment-css/nextjs-plugin';
import { createTheme } from '@mui/material';
const colors = {
background: '#343434',
text: '#000000',
};
const nextConfig = {};
/**
* @type {import('@pigment-css/nextjs-plugin').PigmentOptions}
*/
const pigmentConfig = {
transformLibraries: ['@mui/material'],
theme: createTheme({
+ cssVariables: true,
palette: {
primary: {
main: colors.text,
},
background: {
default: colors.background,
},
text: {
primary: '#FFFFFF',
inverse: '#000000',
},
},
}),
};
export default withPigment(nextConfig, pigmentConfig); |
I'd consider this as a bug. I don't think CSS variables is required to use Pigment CSS. |
This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue. Note @ptpittman How did we do? Your experience with our support team matters to us. If you have a moment, please share your thoughts in this short Support Satisfaction survey. |
Have you tried this recently ? I cloned your repo and tried to run it. I did not run into any issues. |
Steps to reproduce
Link to live example: https://github.com/ptpittman/github-ejtbjs/tree/main
Steps:
Current behavior
I’m migrating a small project into MUI 6/Pigment as a test. I’ve moved all the theme setup over into next.config, DefaultPropsProvider etc, and all is functioning well enough to keep going with it. I have removed ThemeProvider as the docs seem to suggest, which by extension I’d imagine breaks useTheme(). I understand this as a necessity.
However, I use the MUI Slide component on a client nav component, in this sort of way:
This throws:
I’ve attempted to define easing, as follows, for example:
But this does not alleviate the error. Looking at the source of @mui/material/Slide/Slide.js, I see that the defaults have an expectation on useTheme returning transitions, as follows:
I’d imagine this might be the same for other related elements like Fade, but haven’t checked. Is there anyway around this other than restoring ThemeProvider and running a separate client side theme file outside of next.config?
Expected behavior
Slide element should render using default props in a Pigment context.
Context
Render Slide component without error on a client component, using Pigment CSS and MUI 6.
Your environment
npx @mui/envinfo
Search keywords: Slide, Pigment
The text was updated successfully, but these errors were encountered: