Skip to content

Commit

Permalink
Progress bars hacky fixes (epicmaxco#200)
Browse files Browse the repository at this point in the history
* Progress bars hacky fixes

* Remove  blinking on 100%
  • Loading branch information
asvae authored May 7, 2018
1 parent 4c9876a commit a5ce3a6
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 115 deletions.
121 changes: 8 additions & 113 deletions src/components/statistics/progress-bars/ProgressBars.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,131 +2,24 @@
<div class="progress-bars">
<div class="row">
<div class="col-md-12">
<vuestic-widget headerText="Progress Bars">
<div class="row">
<div class="col-sm-4 col-12">
{{'progressBars.basic' | translate}}
<div class="pb-container">
<vuestic-progress-bar ref="hBasic">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thin' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thin" ref="hThin">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thick' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thick" ref="hThick">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.basicVertical' | translate}}
<div class="pb-container">
<div>
<vuestic-progress-bar type="vertical" ref="vBasic"></vuestic-progress-bar>
</div>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thinVertical' | translate}}
<div>
<vuestic-progress-bar size="thin" type="vertical" ref="vThin">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.circle' | translate}}
<div>
<vuestic-progress-bar type="circle" ref="circle"></vuestic-progress-bar>
</div>
</div>
</div>
</vuestic-widget>
<standard-bars/>
</div>
</div>
<div class="row">
<div class="col-md-12">
<vuestic-widget headerText="Colorful Bars">
<div class="row">
<div class="col-sm-4 col-12">
{{'progressBars.basic' | translate}}
<div class="pb-container">
<vuestic-progress-bar ref="chBasic" colorName="danger">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thin' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thin" ref="chThin" colorName="info">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thick' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thick" ref="chThick" colorName="warning">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.basicVertical' | translate}}
<div class="pb-container">
<div>
<vuestic-progress-bar type="vertical" ref="cvBasic" colorName="success"></vuestic-progress-bar>
</div>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thinVertical' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thin" type="vertical" ref="cvThin" colorName="black">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.circle' | translate}}
<div class="pb-container">
<vuestic-progress-bar type="circle" ref="ccircle"></vuestic-progress-bar>
</div>
</div>
</div>
</vuestic-widget>
<colorful-bars/>
</div>
</div>
</div>
</template>

<script>
import ColorfulBars from './Widgets/ColorfulBars'
import StandardBars from './Widgets/StandardBars'
export default {
name: 'progress-bars',
mounted () {
let delay = 0
for (let ref in this.$refs) {
this.$refs[ref].$data.valueAnimationInterval = this.valueAnimationInterval
let timeout = setTimeout(() => {
if (!this.$refs[ref]) {
clearTimeout(timeout)
return
}
this.$refs[ref].$data.value = 100
}, delay)
delay += this.valueAnimationInterval
}
},
data () {
return {
valueAnimationInterval: 3000
}
}
components: { StandardBars, ColorfulBars },
}
</script>

Expand All @@ -136,6 +29,8 @@
@import "~bootstrap/scss/variables";
@import "../../../sass/mixins";
// HACK Shouldn't be here.
.progress-bars {
.vuestic-progress-bar {
.progress.thick {
Expand Down
57 changes: 57 additions & 0 deletions src/components/statistics/progress-bars/Widgets/ColorfulBars.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<vuestic-widget headerText="Colorful Bars">
<div class="row">
<div class="col-sm-4 col-12">
{{'progressBars.basic' | translate}}
<div class="pb-container">
<vuestic-progress-bar ref="chBasic" colorName="danger"/>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thin' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thin" ref="chThin" colorName="info"/>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thick' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thick" ref="chThick" colorName="warning"/>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.basicVertical' | translate}}
<div class="pb-container">
<div>
<vuestic-progress-bar type="vertical" ref="cvBasic"
colorName="success"/>
</div>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thinVertical' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thin" type="vertical" ref="cvThin"
colorName="black"/>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.circle' | translate}}
<div class="pb-container">
<vuestic-progress-bar type="circle" ref="ccircle"/>
</div>
</div>
</div>
</vuestic-widget>
</template>

<script>
export default {
name: 'standard-bars',
mounted () {
for (let ref in this.$refs) {
this.$refs[ref].value = 100
}
},
}
</script>
75 changes: 75 additions & 0 deletions src/components/statistics/progress-bars/Widgets/StandardBars.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<template>
<vuestic-widget headerText="Progress Bars">
<div class="row">
<div class="col-sm-4 col-12">
{{'progressBars.basic' | translate}}
<div class="pb-container">
<vuestic-progress-bar ref="hBasic">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thin' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thin" ref="hThin">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thick' | translate}}
<div class="pb-container">
<vuestic-progress-bar size="thick" ref="hThick">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.basicVertical' | translate}}
<div class="pb-container">
<div>
<vuestic-progress-bar type="vertical"
ref="vBasic"></vuestic-progress-bar>
</div>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.thinVertical' | translate}}
<div>
<vuestic-progress-bar size="thin" type="vertical" ref="vThin">
</vuestic-progress-bar>
</div>
</div>
<div class="col-sm-4 col-12">
{{'progressBars.circle' | translate}}
<div>
<vuestic-progress-bar type="circle"
ref="circle"></vuestic-progress-bar>
</div>
</div>
</div>
</vuestic-widget>
</template>

<script>
export default {
name: 'standard-bars',
data () {
return {
valueAnimationInterval: 3000
}
},
mounted () {
let delay = 0
for (let ref in this.$refs) {
this.$refs[ref].$data.valueAnimationInterval = this.valueAnimationInterval
let timeout = setTimeout(() => {
if (!this.$refs[ref]) {
clearTimeout(timeout)
return
}
this.$refs[ref].$data.value = 100
}, delay)
delay += this.valueAnimationInterval
}
},
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@
let progressColor = color(this.color)
let current = progressColor
setInterval(() => {
if (this.animatedValue === 100) {
current = progressColor
progressBar.style.backgroundColor = current()
return
}
if (progressColor(lightness(30))() !== current()) {
current = progressColor(lightness(30))
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,16 @@
'isActive'
],
mounted () {
// Starts blinking
let progressBar = this.$refs.progressBar
let progressColor = color(this.color)
let current = progressColor
setInterval(() => {
if (this.animatedValue === 100) {
current = progressColor
progressBar.style.backgroundColor = current()
return
}
if (progressColor(lightness(30))() !== current()) {
current = progressColor(lightness(30))
} else {
Expand Down Expand Up @@ -56,8 +62,8 @@
display: -ms-flexbox; /* TWEENER - IE 10 */
display: -webkit-flex; /* NEW - Safari 6.1+. iOS 7.1+, BB10 */
display: flex; /* NEW, Spec - Firefox, Chrome, Opera */
align-items: flex-start;
-webkit-align-items: flex-start; /* Safari 7.0+ */
align-items: flex-end;
-webkit-align-items: flex-end; /* Safari 7.0+ */
}
.value{
Expand Down

0 comments on commit a5ce3a6

Please sign in to comment.