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

[Alert] Fix square Paper prop #30027

Merged
merged 5 commits into from
Dec 6, 2021

Conversation

ZeeshanTamboli
Copy link
Member

@ZeeshanTamboli ZeeshanTamboli commented Dec 3, 2021

Related to #28193, #29726 , #29288 and #30014

By default, we have square prop passed to Alert component. See:
https://github.com/mui-org/material-ui/blob/22c34014eeba310cefab4c93005ec9959dc51a96/packages/mui-material/src/Alert/Alert.js#L148-L150

But due to borderRadius styling in Alert component the rounded corners were still enabled. I am not sure whether we want or not want rounded corners by default in Alert.

I concluded by the code that rounded corners should be off. But then I guess it would be a breaking change now. (Argos may fail).

If developers want to enable rounded corners, now they will have to instead explicitly do:

<Alert square={false} />

Let me know if want to it the other way by keeping the rounded corners to avoid breaking change. Like we have it now.

Edit: Kept rounded corners by default.

@ZeeshanTamboli ZeeshanTamboli added component: alert This is the name of the generic UI component, not the React module! bug 🐛 Something doesn't work labels Dec 3, 2021
@mui-pr-bot
Copy link

mui-pr-bot commented Dec 3, 2021

Details of bundle changes

@material-ui/core: parsed: +Infinity% , gzip: +Infinity%
@material-ui/lab: parsed: +Infinity% , gzip: +Infinity%
@material-ui/styles: parsed: +Infinity% , gzip: +Infinity%
@material-ui/private-theming: parsed: +Infinity% , gzip: +Infinity%
@material-ui/system: parsed: +Infinity% , gzip: +Infinity%
@material-ui/unstyled: parsed: +Infinity% , gzip: +Infinity%
@material-ui/utils: parsed: +Infinity% , gzip: +Infinity%

Generated by 🚫 dangerJS against 1cc60d7

@ZeeshanTamboli ZeeshanTamboli marked this pull request as ready for review December 3, 2021 12:22
@ZeeshanTamboli ZeeshanTamboli changed the title [Alert] Fix square prop [Alert] Fix square Paper prop Dec 3, 2021
@hbjORbj
Copy link
Member

hbjORbj commented Dec 3, 2021

Thanks for your contribution. As you already mentioned, changing the default border radius to 0px is a breaking change, so I'd not go for it. I think the following change is sufficient.

diff --git a/packages/mui-material/src/Alert/Alert.js b/packages/mui-material/src/Alert/Alert.js
index 436d710c26..a362390b69 100644
--- a/packages/mui-material/src/Alert/Alert.js
+++ b/packages/mui-material/src/Alert/Alert.js
@@ -47,7 +47,7 @@ const AlertRoot = styled(Paper, {
 
   return {
     ...theme.typography.body2,
-    borderRadius: theme.shape.borderRadius,
+    borderRadius: ownerState.square ? 0 : theme.shape.borderRadius,
     backgroundColor: 'transparent',
     display: 'flex',
     padding: '6px 16px',
@@ -147,7 +147,6 @@ const Alert = React.forwardRef(function Alert(inProps, ref) {
   return (
     <AlertRoot
       role={role}
-      square
       elevation={0}
       ownerState={ownerState}
       className={clsx(classes.root, className)}

Copy link
Member

@mnajdova mnajdova left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes look clear to me, they are not breaking, so all is good from my side. Thanks!

Copy link
Member

@hbjORbj hbjORbj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for your contribution!! :)

@hbjORbj hbjORbj merged commit 47877e3 into mui:master Dec 6, 2021
@ZeeshanTamboli ZeeshanTamboli deleted the fix-square-prop-alert-component branch December 6, 2021 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug 🐛 Something doesn't work component: alert This is the name of the generic UI component, not the React module!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants