-
Notifications
You must be signed in to change notification settings - Fork 918
feat(theme-default): add css variables for transition #325
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
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.
Removed --t vars in other plugins. This will cause transform-duration of these plugins to remain unchanged when user modifies --t-duration.
| --t-duration: 0.3s; | ||
| --t-duration-slide: 0.3s; | ||
| --t-all: all var(--t-duration); | ||
| --t-opacity: opacity var(--t-duration); | ||
| --t-color: color var(--t-duration); | ||
| --t-border-color: border-color var(--t-duration); | ||
| --t-background-color: background-color var(--t-duration); | ||
| --t-color-all: var(--t-color), var(--t-border-color), | ||
| var(--t-background-color); | ||
| --t-transform: transform var(--t-duration); |
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.
Seems that transition-timing-function is not supported?
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.
| transition: all 0.3s ease; | ||
| transition: all var(--t-duration-slide) ease; | ||
| } | ||
|
|
||
| .fade-slide-y-leave-active { | ||
| transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1); | ||
| transition: all var(--t-duration-slide) cubic-bezier(1, 0.5, 0.8, 1); |
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.
As the other parts of are not customizable, I think we could just leave the duration constant?
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.
| --t-duration: 0.3s; | ||
| --t-duration-slide: 0.3s; | ||
| --t-timing-function: ease; |
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.
Maybe we could merge them into a single var, because "duration" and "timing function" always appear together in following usage.
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.
OK. Users can control transition-duration, transition-timing-function and transition-delay in a single variable in this way.
| --t-options: 0.3s ease; | ||
| --t-all: all var(--t-options); | ||
| --t-opacity: opacity var(--t-options); | ||
| --t-color: color var(--t-options); | ||
| --t-border-color: border-color var(--t-options); | ||
| --t-background-color: background-color var(--t-options); | ||
| --t-color-all: var(--t-color), var(--t-border-color), | ||
| var(--t-background-color); | ||
| --t-transform: transform var(--t-options); |
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.
One more thing: there are two different naming patterns
--t-${propertyName}:--t-all,--t-opacity,--t-color--t-${somethingElse}:--t-options,--t-color-all
Any good idea to normalize the naming pattern?
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.
Maybe an extra prefix --t-p- for property name? 🤔
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.
| --t-p-all: all var(--t-options); | ||
| --t-p-opacity: opacity var(--t-options); | ||
| --t-p-transform: transform var(--t-options); | ||
| --t-p-color: color var(--t-options); | ||
| --t-p-border-color: border-color var(--t-options); | ||
| --t-p-background-color: background-color var(--t-options); | ||
| --t-color-all: var(--t-p-color), var(--t-p-border-color), | ||
| var(--t-p-background-color); |
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.
Well, after some discussion, both @shigma and me think we might not need so many vars for transitions.
IMO, only the --t-options is helpful for reusing the transition options. 🤔
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.
Although this PR is intended to provide scalability, I believe consistency is also important to a theme.
For theme-default, two transition variables are enough. One for color (color, border-color, background-color, etc) and the other for position (left, right, top, bottom, width, height, transform, etc).
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.
What naming convention is better to use in _variables.scss?
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.
I think using color var(--t-color-options) directly is enough 🤔 No need to add extra scss variables
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.
| @@ -1,3 +1,5 @@ | |||
| @import '_variables'; | |||
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.
Should be removed
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.
meteorlxy
left a comment
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.
LGTM. What's your opinion @shigma ?
From this review