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

[PropTypes] Add variants primary and secondary to proptypes #12990

Closed
2 tasks done
JeanBeaurepaire opened this issue Sep 24, 2018 · 4 comments
Closed
2 tasks done

[PropTypes] Add variants primary and secondary to proptypes #12990

JeanBeaurepaire opened this issue Sep 24, 2018 · 4 comments

Comments

@JeanBeaurepaire
Copy link
Contributor

JeanBeaurepaire commented Sep 24, 2018

It would be great if we could add more types of props color to the color props

  • This is not a v0.x issue.
  • I have searched the issues of this repository and believe that this is not a duplicate.

Expected Behavior

I want to be able to display on my components who have color props:

  • secondaryLight
  • secondaryDark
  • primaryLight
  • primaryDark

Current Behavior

I can only display my primary and my secondary color.
export namespace PropTypes { type Color = 'inherit' | 'primary' | 'secondary' | 'default'; }

Examples

https://material.io/design/color/the-color-system.html#color-theme-creation

For example based on the material spec, you can make a color theme for your app using your primary color, as well as dark and light primary variants.

Context

Sometimes, I would like do display some components with some variants color and I can't display those variants with the current color PropsTypes.

@JeanBeaurepaire JeanBeaurepaire changed the title [PropTypes] Add light and dark color to proptypes [PropTypes] Add variants primary and secondary to proptypes Sep 24, 2018
@oliviertassinari
Copy link
Member

@Abbo44 At work, we have been writing a wrapper component to solve this problem. I'm eager to explore the alternatives to this strategy.

@JeanBeaurepaire
Copy link
Contributor Author

I don't know exactly the alternatives but I think it's important to have the choice to display the variants of the primary and secondary color.
If you have an existant solution, could you inform it on the material ui colors doc for example ? It would be a beginning.

It could also be an other optionnal props called colorVariant in the component who has already the color props, where we could write if the variant color is main , light or dark . By default the variant would be main

@eps1lon
Copy link
Member

eps1lon commented Sep 24, 2018

To be honest I'm not a fan of style props. You can already do this by passing your own className with withStyles and theme.palette[variant]['light' | 'main' | 'dark'].

We have to define new classNames and props which increases API surface and bundle size for everyone when this feature is already supported.

@eps1lon
Copy link
Member

eps1lon commented Jun 28, 2019

Duplicate of #13875

@eps1lon eps1lon marked this as a duplicate of #13875 Jun 28, 2019
@eps1lon eps1lon closed this as completed Jun 28, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants