-
Notifications
You must be signed in to change notification settings - Fork 135
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
feat(variants): add defaults to theme #51
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work!
Just one note, this will allow you to pass variant="defaults"
to a component. I think we should remove "defaults"
as a valid option, at least in the prop types.
I too noticed this, but didn't see much harm. |
Added in an omit for defaults (to the types only): /~https://github.com/Shopify/restyle/pull/51/files#diff-d11836bc5f23eb547c1e6e3dd4325c12R80 |
Co-authored-by: Joel Besada <joel.besada@gmail.com>
Goal
The idea of this PR is to add support for defaults in the theme object for the specific variant.
Problem
Currently specifying defaults can only be done when creating a variant, which is both limiting (i.e. no defaults for the
createText
export) and not in the same location as all the other styles (i.e. developers will forget they exist).Usage
Implementation
Styles will be applied in the following order
{...createVariantDefaults, ...themeVariantDefaults, ...actualVariantStyles},
Tests
Existing tests completed successfully without modifications.
New tests added to ensure the styles are applied (and in the correct order, with overrides).
Closes GH-49