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

default variant #5

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ahmetkuslular
Copy link

  • If the variant sent does not match, the default variant usage is added

@@ -30,7 +30,11 @@ function theme(name, values) {
theme.variants = function(name, prop, values) {
return function(props) {
var variant = props[prop] && values[props[prop]];
return variant && getThemeValue(name, props, variant);
var defaultVariant = props[prop] && values['default'];
Copy link

Choose a reason for hiding this comment

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

This assumes that there is 'default' key in the variants object. In few use cases we may not be having 'default' as one of the item in the list of variants. In such case, I suggest to use the first item from the list of variants as a fallback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants