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

[core] Remove usage of theme.spacing.unit #12022

Merged

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Jun 30, 2018

This change comes from an internal discussion with @mbrookes. The usage of theme.spacing.unit was only here to illustrate the link with the 8dp spacing unit. In practice, we do not expect people to change the value. By doing this change, we make the style generation lighter (-0.3 Kb gzipped).

P.S. I have only changed the source code, not the demos.
P.S. I wish we had a performance benchmark to see the implications of such change.

@oliviertassinari oliviertassinari force-pushed the remove-theme-spacing-unit branch 2 times, most recently from e248ef7 to 254208a Compare June 30, 2018 22:02
@oliviertassinari oliviertassinari self-assigned this Jun 30, 2018
@@ -83,11 +83,11 @@ const styles = theme => ({
fontSize: 16,
color: theme.palette.text.primary,
'& .anchor-link': {
marginTop: -theme.spacing.unit * 12, // Offset for the anchor.
marginTop: -8 * 12, // Offset for the anchor.
Copy link
Member

Choose a reason for hiding this comment

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

Even though it's a bit more work, I would just make this -96, and so on.

Copy link
Member Author

Choose a reason for hiding this comment

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

Alright

@oliviertassinari oliviertassinari merged commit c92d9f2 into mui:master Jul 1, 2018
@oliviertassinari oliviertassinari deleted the remove-theme-spacing-unit branch July 1, 2018 19:25
@vuhrmeister
Copy link

So you encourage people to not use theme.spacing.unit as well? I'm using it everywhere 😄

@oliviertassinari
Copy link
Member Author

oliviertassinari commented Jul 3, 2018

@vuhrmeister No, by keeping it in the demos, we are still encouraging people to use it. I'm using it everywhere too on the product I'm working on.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants