Skip to content
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

[system] Make @emotion/* fully supported in the System #33205

Merged
merged 9 commits into from
Aug 1, 2022
5 changes: 3 additions & 2 deletions packages/mui-material/src/Button/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ const Button = React.forwardRef(function Button(inProps, ref) {
variant,
};

const classes = useUtilityClasses(ownerState);
// eslint-disable-next-line @typescript-eslint/naming-convention
const { root: classes_root, ...classes } = useUtilityClasses(ownerState);
mnajdova marked this conversation as resolved.
Show resolved Hide resolved

const startIcon = startIconProp && (
<ButtonStartIcon className={classes.startIcon} ownerState={ownerState}>
Expand All @@ -339,7 +340,7 @@ const Button = React.forwardRef(function Button(inProps, ref) {
return (
<ButtonRoot
ownerState={ownerState}
className={clsx(className, contextProps.className)}
className={clsx(contextProps.className, classes_root, className)}
mnajdova marked this conversation as resolved.
Show resolved Hide resolved
mnajdova marked this conversation as resolved.
Show resolved Hide resolved
component={component}
disabled={disabled}
focusRipple={!disableFocusRipple}
Expand Down
24 changes: 24 additions & 0 deletions test/regressions/fixtures/Emotion/Emotion.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import * as React from 'react';
import { ClassNames } from '@emotion/react';
import Button from '@mui/material/Button';

export default function Cx() {
return (
<ClassNames>
{({ css }) => (
<React.Fragment>
<Button color="primary" classes={{ root: css({ color: 'pink' }) }}>
This text should be pink
</Button>
<Button
color="primary"
className={css({ color: 'red' })}
classes={{ root: css({ color: 'pink' }) }}
>
This text should be red
</Button>
</React.Fragment>
)}
</ClassNames>
);
}