Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e58acd1
commit 2e811f3
Showing
3 changed files
with
118 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,89 @@ | ||
@import '../constants.styl' | ||
|
||
// -- Main styles | ||
// -- NOTE: Parameters depend on the component SVG Markup too | ||
CIRCLE_WRAPPER_WIDTH = 100 | ||
CIRCLE_RADIUS = 45 | ||
SCALE_RATIO = CIRCLE_RADIUS/20 | ||
|
||
[data-component-progressbar] | ||
display : inline-block | ||
position : relative | ||
height : PROGRESS_BAR_HEIGHT | ||
width : 100% | ||
background : darken(BACKGROUND, 7.5%) | ||
overflow : hidden | ||
|
||
[data-component-progressbar-value], [data-component-progressbar-buffer] | ||
position : absolute | ||
bottom : 0 | ||
left : 0 | ||
right : 0 | ||
top : 0 | ||
transform scaleX(0) | ||
transform-origin left center | ||
transition-duration ANIMATION_DURATION | ||
transition-timing-function ANIMATION_EASE | ||
|
||
[data-component-progressbar-value] | ||
background-color : SECONDARY | ||
|
||
[data-component-progressbar-buffer] | ||
background-color : alpha(SECONDARY, 15%) | ||
|
||
&.indeterminate > [data-component-progressbar-value] | ||
transform-origin center center | ||
animation indeterminate-bar 1s linear infinite | ||
|
||
// -- Animation for the indeterminate progress bar | ||
@keyframes indeterminate-bar | ||
display : inline-block | ||
|
||
&.linear | ||
position : relative | ||
height : PROGRESS_BAR_HEIGHT | ||
width : 100% | ||
background : darken(BACKGROUND, 7.5%) | ||
overflow : hidden | ||
|
||
[data-component-progressbar-value], [data-component-progressbar-buffer] | ||
position : absolute | ||
bottom : 0 | ||
left : 0 | ||
right : 0 | ||
top : 0 | ||
transform scaleX(0) | ||
transform-origin left center | ||
transition-duration ANIMATION_DURATION | ||
transition-timing-function ANIMATION_EASE | ||
|
||
[data-component-progressbar-value] | ||
background-color : SECONDARY | ||
|
||
[data-component-progressbar-buffer] | ||
background-color : alpha(SECONDARY, 15%) | ||
|
||
&.indeterminate [data-component-progressbar-value] | ||
transform-origin center center | ||
animation linear-indeterminate-bar 1s linear infinite | ||
|
||
&.circular | ||
position : relative | ||
height : CIRCLE_WRAPPER_WIDTH * 1px | ||
width : CIRCLE_WRAPPER_WIDTH * 1px | ||
transform rotate(-90deg) | ||
|
||
[data-component-progressbar-circle] | ||
height : 100% | ||
width : 100% | ||
|
||
[data-component-progressbar-circle-path] | ||
stroke-dasharray : 0, SCALE_RATIO * 200 | ||
stroke-dashoffset : 0 | ||
stroke-linecap : round | ||
stroke-miterlimit : 20 | ||
stroke-width : 4 | ||
stroke : SECONDARY | ||
fill : none | ||
transition stroke-dasharray ANIMATION_DURATION ANIMATION_EASE | ||
|
||
&.indeterminate | ||
[data-component-progressbar-circle] | ||
animation circular-indeterminate-bar-rotate 2s linear infinite | ||
|
||
[data-component-progressbar-circle-path] | ||
stroke-dasharray : SCALE_RATIO * 1, SCALE_RATIO * 200 | ||
stroke-dashoffset : 0 | ||
animation circular-indeterminate-bar-dash 1.5s ease-in-out infinite | ||
|
||
@keyframes linear-indeterminate-bar | ||
0% | ||
transform translate(-50%) scaleX(0) | ||
50% | ||
transform translate(-0%) scaleX(0.3) | ||
100% | ||
transform translate(50%) scaleX(0) | ||
|
||
@keyframes circular-indeterminate-bar-rotate | ||
100% | ||
transform : rotate(360deg) | ||
|
||
@keyframes circular-indeterminate-bar-dash | ||
0% | ||
transform: translate(-50%) scaleX(0) | ||
stroke-dasharray : SCALE_RATIO * 1, SCALE_RATIO * 200 | ||
stroke-dashoffset : SCALE_RATIO * 0 | ||
50% | ||
transform: translate(0%) scaleX(0.3) | ||
stroke-dasharray : SCALE_RATIO * 89, SCALE_RATIO * 200 | ||
stroke-dashoffset : SCALE_RATIO * -35 | ||
100% | ||
transform: translate(50%) scaleX(0) | ||
stroke-dasharray : SCALE_RATIO * 89, SCALE_RATIO * 200 | ||
stroke-dashoffset : SCALE_RATIO * -124 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters