-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Code Quality: Improve prefix, better scope, for animations #11752
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,78 +1,13 @@ | ||
@keyframes fade-in { | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
@mixin editor-animation__loading-fade { | ||
animation: editor-animation__loading-fade 1.6s ease-in-out infinite; | ||
} | ||
|
||
@mixin animate_fade { | ||
animation: animate_fade 0.1s ease-out; | ||
@mixin editor-animation__fade-in($speed: 0.2s, $delay: 0s) { | ||
animation: editor-animation__fade-in $speed ease-out $delay; | ||
animation-fill-mode: forwards; | ||
} | ||
|
||
@mixin move_background { | ||
background-size: 28px 28px; | ||
animation: move_background 0.5s linear infinite; | ||
} | ||
|
||
@mixin loading_fade { | ||
animation: loading_fade 1.6s ease-in-out infinite; | ||
} | ||
|
||
@mixin slide_in_right { | ||
transform: translateX(+100%); | ||
animation: slide_in_right 0.1s forwards; | ||
} | ||
|
||
@mixin slide_in_top { | ||
transform: translateY(-100%); | ||
animation: slide_in_top 0.1s forwards; | ||
} | ||
|
||
@mixin fade_in($speed: 0.2s, $delay: 0s) { | ||
animation: fade-in $speed ease-out $delay; | ||
animation-fill-mode: forwards; | ||
} | ||
|
||
@keyframes editor_region_focus { | ||
from { | ||
box-shadow: inset 0 0 0 0 $blue-medium-400; | ||
} | ||
to { | ||
box-shadow: inset 0 0 0 4px $blue-medium-400; | ||
} | ||
} | ||
|
||
@mixin region_focus($speed: 0.2s) { | ||
animation: editor_region_focus $speed ease-out; | ||
animation-fill-mode: forwards; | ||
} | ||
|
||
@keyframes rotation { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} | ||
|
||
@mixin animate_rotation($speed: 1s) { | ||
animation: rotation $speed infinite linear; | ||
} | ||
|
||
@keyframes modal-appear { | ||
from { | ||
margin-top: $grid-size * 4; | ||
} | ||
to { | ||
margin-top: 0; | ||
} | ||
} | ||
|
||
@mixin modal_appear() { | ||
animation: modal-appear 0.1s ease-out; | ||
@mixin editor-animation__modal-appear() { | ||
animation: editor-animation__modal-appear 0.1s ease-out; | ||
animation-fill-mode: forwards; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,15 @@ | |
height: 4px; | ||
border-radius: 100%; | ||
transform-origin: 6px 6px; | ||
@include animate_rotation; | ||
animation: editor-animation__rotation 1s infinite linear; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could we give it a name using our guidelines: |
||
} | ||
} | ||
|
||
@keyframes editor-animation__rotation { | ||
from { | ||
transform: rotate(0deg); | ||
} | ||
to { | ||
transform: rotate(360deg); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,9 +19,16 @@ body.is-fullscreen-mode { | |
} | ||
|
||
// Animations | ||
@include fade_in(0.3s); | ||
@include editor-animation__fade-in(0.3s); | ||
|
||
.edit-post-header { | ||
@include slide_in_top(); | ||
transform: translateY(-100%); | ||
animation: editor-animation__slide-in-top 0.1s forwards; | ||
} | ||
} | ||
|
||
@keyframes editor-animation__slide-in-top { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could this be |
||
100% { | ||
transform: translateY(0%); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -128,14 +128,21 @@ | |
left: auto; | ||
width: $sidebar-width; | ||
border-left: $border-width solid $light-gray-500; | ||
@include slide_in_right; | ||
transform: translateX(+100%); | ||
animation: editor-animation__slide-in-right 0.1s forwards; | ||
|
||
body.is-fullscreen-mode & { | ||
top: 0; | ||
} | ||
} | ||
} | ||
|
||
@keyframes editor-animation__slide-in-right { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This could be |
||
100% { | ||
transform: translateX(0%); | ||
} | ||
} | ||
|
||
.edit-post-layout .editor-post-publish-panel__header-publish-button { | ||
// Match the size of the Publish... button. | ||
.components-button.is-large { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,28 +20,15 @@ | |
@import "./components/visual-editor/style.scss"; | ||
@import "./components/options-modal/style.scss"; | ||
|
||
// Fade animations | ||
@keyframes animate_fade { | ||
from { | ||
opacity: 0; | ||
transform: translateY(4px); | ||
} | ||
to { | ||
opacity: 1; | ||
transform: translateY(0); | ||
} | ||
} | ||
|
||
@keyframes move_background { | ||
from { | ||
background-position: 0 0; | ||
} | ||
to { | ||
background-position: 28px 0; | ||
} | ||
} | ||
/** | ||
* Animations | ||
*/ | ||
|
||
@keyframes loading_fade { | ||
// These keyframes should not be part of the _animations.scss mixins file. | ||
// Because keyframe animations can't be defined as mixins properly, they are duplicated. | ||
// Since hey are intended only for the editor, we add them here instead. | ||
@keyframes editor-animation__loading-fade { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe more |
||
0% { | ||
opacity: 0.5; | ||
} | ||
|
@@ -53,15 +40,21 @@ | |
} | ||
} | ||
|
||
@keyframes slide_in_right { | ||
100% { | ||
transform: translateX(0%); | ||
@keyframes editor-animation__fade-in { | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes slide_in_top { | ||
100% { | ||
transform: translateY(0%); | ||
@keyframes editor-animation__modal-appear { | ||
from { | ||
margin-top: $grid-size * 4; | ||
} | ||
to { | ||
margin-top: 0; | ||
} | ||
} | ||
|
||
|
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.
This mixin doesn't seem useful as use only once, we can move it and rename it as well?