-
-
Notifications
You must be signed in to change notification settings - Fork 32.6k
[CardContent] Use theme.spacing()
instead of hardcoded values
#32471
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
base: v5.x
Are you sure you want to change the base?
[CardContent] Use theme.spacing()
instead of hardcoded values
#32471
Conversation
Bundle size will be reported once CircleCI build #465837 finishes. |
maxWidth: 'calc(150% - 24px)', | ||
transform: 'translate(12px, -9px) scale(0.70)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this change? Let's not change this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ZeeshanTamboli sorry this changes were related to another pull request
import createTheme from '../styles/createTheme'; | ||
|
||
const theme = createTheme(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not needed. You can access the theme
in styled()
API
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What do you mean we can access it through the api ? can you give me an example please
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const StyledTableCell = styled(TableCell)(({ theme }) => ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also i opened this pull request because of this issue #32155
theme.spacing()
instead of hardcoded values
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also I think this would be a breaking change in case some apps have their own theme customization with their own spacing values as mentioned in #32155 (comment)
@@ -22,9 +22,9 @@ const CardContentRoot = styled('div', { | |||
overridesResolver: (props, styles) => styles.root, | |||
})(() => { | |||
return { | |||
padding: 16, | |||
padding: styled.theme.spacing(2), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TypeError: Cannot read property 'spacing' of undefined
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be
})(({ theme }) => {
return {
padding: theme.spacing(2),
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the reviews.
Signed-off-by: Marija Najdova <mnajdova@gmail.com>
Signed-off-by: Marija Najdova <mnajdova@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, we will need to wait for v6 before we can merge this.
Closes #32155