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

[palette] Normalize the usage of the palette #9970

Merged
merged 1 commit into from
Jan 21, 2018

Conversation

oliviertassinari
Copy link
Member

@oliviertassinari oliviertassinari commented Jan 20, 2018

  • Normalize the usage of the palette! 💃
  • Do not crash when users aren't correctly using the color manipulator API. I would rather click on an ugly working button than wait for the page to be fixed. It was failing with this line color.charAt(0). Instead, we return the color and raise a warning.
  • Normalize TableRow classes with TableCell classes.
  • Remove duplicated regression tests.
  • Add comments in the palette source code.
  • Fix some TypeScript issues.

All of this started in my effort to document the theme variables. Turns out, the implementation was a mess. I have done my best to simplify it, going back and forth with the specification.
Closes #9922.

Breaking change

  • Remove theme.palette.input object.
  • Remove theme.palette.text.icon color.
  • Remove theme.palette.background.contentFrame, it was only used in the documentation.
  • Move theme.palette.text.divider to theme.palette.divider, it's not a text color.
  • Remove theme.palette.text.lightDivider, there is no reference to is in the specification, better keep things simple.

Copy link
Member

@mbrookes mbrookes left a comment

Choose a reason for hiding this comment

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

That's a great improvement!

@@ -24,7 +24,8 @@ const styles = theme => ({
},
},
demo: theme.mixins.gutters({
backgroundColor: theme.palette.background.contentFrame,
backgroundColor:
theme.palette.type === 'light' ? theme.palette.grey[200] : theme.palette.grey[900],
Copy link
Member

Choose a reason for hiding this comment

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

I'm not convinced theme.palette.grey should exist in the default theme. Two components (Button & ExpansionPanelSummary) are using it for a background color when that should be in theme.palette.background, and one, Switch, should probably be calculating its color some other way (I didn't look further).

In the docs we can just import grey directly.

Copy link
Member Author

@oliviertassinari oliviertassinari Jan 20, 2018

Choose a reason for hiding this comment

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

grey exists in the default theme because we already import it. It's mainly here for the ease of use. Let's see if we can remove it from the core components to start with :) .

Copy link
Member

@mbrookes mbrookes Jan 20, 2018

Choose a reason for hiding this comment

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

grey existe in the default theme because we already import it

Sure, but then we also import other colors, and they're not added to the theme.

Let's see if we can remove it from the core components

Sure, but in that case, lets not add it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

I won't remove the grey usage. I remember why we inject it now: so people can provide their own tones.

Copy link
Member

Choose a reason for hiding this comment

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

@oliviertassinari. If we fix the couple of components using this to use more appropriate theme keys, users can still change them there.

Don't worry if you don't want to fix it here. I can handle it in a separate PR. One more line to fix in the docs won't make a difference.

Copy link
Member Author

@oliviertassinari oliviertassinari Jan 20, 2018

Choose a reason for hiding this comment

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

If we fix the couple of components using this to use more appropriate theme keys

Same, I have been going the other way around. the palette isn't a hub for all the configuration variables the components might need (we gonna need another solution for this). I think that we should aim for a palette as slim as possible. People shouldn't pay tooltip variable cost when only using a button. Also, it won't scale to the third party components. Code splitting is important. It's also simpler to document.

Copy link
Member

Choose a reason for hiding this comment

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

the palette isn't a hub for all the configuration variables the components might need

Agreed.

(we gonna need another solution for this)

You've already documented a couple. Do we need anything more?

Copy link
Member Author

@oliviertassinari oliviertassinari Jan 20, 2018

Choose a reason for hiding this comment

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

You've already documented a couple. Do we need anything more?

@mbrookes I have been wondering about it since 2016 when @nathanmarks redesigned the styling & theming solution. I don't have the answer 🤔 .

@oliviertassinari oliviertassinari force-pushed the docs-theme-details branch 5 times, most recently from 175150e to bbc7120 Compare January 20, 2018 22:35
@oliviertassinari oliviertassinari changed the title [palette] More detailed palette documentation [palette] Normalize the usage of the palette Jan 20, 2018
@oliviertassinari oliviertassinari added the design: material This is about Material Design, please involve a visual or UX designer in the process label Jan 20, 2018
@oliviertassinari
Copy link
Member Author

Piou, I'm done!

Copy link
Member

@mbrookes mbrookes left a comment

Choose a reason for hiding this comment

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

🥇

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change design: material This is about Material Design, please involve a visual or UX designer in the process
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants