CodeYellowBV / re-cy-cle

React component library for Code Yellow
https://codeyellowbv.github.io/re-cy-cle/
6 stars 6 forks source link

An overridable primary color per component. #68

Closed stam closed 7 years ago

stam commented 7 years ago

There currently are a lot of component which use the primaryColor. This can however look quite monotone, so you might want to have some components deviate from the primaryColor.

I think the best place to define such a deviation is in the ReCyCleTheme.

In the current implementation: users can specify a primaryButtonColor. If it is not specified, it will fallback to the theme's primaryColor.

In this PR, this fallback is handled in ReCyCleTheme.getTheme, where a fallback object is created based on config.overridablePrimaryColors. We cannot simply set these defaults in config.defaultConfig as the values need to fall back to the primaryColor provided in the ReCyCleTheme theme props.

getTheme however is executed quite often when clicking through storybook, but I was unsure if this needed fixing in re-cy-cle or was just inherent to how storybook works.

SpaceK33z commented 7 years ago

The only thing I don't like is that it is specific to primaryColor. There are a lot more colors that might need overriding. However I guess this is a good first step.

getTheme however is executed quite often when clicking through storybook, but I was unsure if this needed fixing in re-cy-cle or was just inherent to how storybook works.

Yes normally it isn't called often.