Skip to content

Commit

Permalink
Fix/bugs 2.0: update progress bar presentation (epicmaxco#690)
Browse files Browse the repository at this point in the history
* fix(bugs-2.0): change progress bar presentation

* fix(bugs-2.0): change progress bar presentation

* fix(bugs-2.0): minor changes
  • Loading branch information
AlexanderBoriskin authored Jan 29, 2020
1 parent 448c224 commit ff7cf04
Show file tree
Hide file tree
Showing 5 changed files with 79 additions and 65 deletions.
8 changes: 7 additions & 1 deletion src/components/statistics/progress-bars/ProgressBars.vue
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@
<horizontal-bars/>
</div>
</div>
<div class="row">
<div class="flex xs12">
<bars-state/>
</div>
</div>
<div class="row">
<div class="flex xs12">
<circle-bars/>
Expand All @@ -21,10 +26,11 @@
<script>
import HorizontalBars from './Widgets/HorizontalBars'
import CircleBars from './Widgets/CircleBars'
import BarsState from './Widgets/BarsState'
import ColorfulBars from './Widgets/ColorfulBars'
export default {
name: 'progress-bars',
components: { HorizontalBars, CircleBars, ColorfulBars },
components: { HorizontalBars, CircleBars, BarsState, ColorfulBars },
}
</script>
58 changes: 58 additions & 0 deletions src/components/statistics/progress-bars/Widgets/BarsState.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
<template>
<va-card
class="bars-state"
:title="$t('progressBars.state')"
>
<div class="row">
<div class="flex md4 xs12">
<va-progress-bar :value="value2">66%</va-progress-bar>
</div>
<div class="flex md4 xs12">
<va-progress-bar
:value="bufferValues.value"
:buffer="bufferValues.buffer"
>Buffering
</va-progress-bar>
</div>
<div class="flex md4 xs12">
<va-progress-bar indeterminate>Loading</va-progress-bar>
</div>
</div>
</va-card>
</template>

<script>
export default {
name: 'bars-state',
data () {
return {
value2: 66,
bufferValues: {
value: 0,
buffer: 0,
},
}
},
mounted () {
this.animateValue()
this.animateBufferValues()
},
methods: {
animateValue () {
setTimeout(() => {
this.value = 100
})
},
animateBufferValues () {
const interval = setInterval(() => {
this.bufferValues.value += 2 + Math.floor(Math.random() * 2)
this.bufferValues.buffer += 2 + Math.floor(Math.random() * 4)
if (this.bufferValues.value >= 100) {
clearInterval(interval)
}
}, 400)
},
},
}
</script>
17 changes: 0 additions & 17 deletions src/components/statistics/progress-bars/Widgets/CircleBars.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,6 @@
class="circle-bars"
:title="$t('progressBars.circle')"
>
<div class="row">
<div v-for="n in 10" :key="n" class="flex xs4 sm2 lg1">
<div class="d-flex justify--center">
<div>
<va-progress-circle :value="value * n / 10"/>
</div>
</div>
</div>
<div class="flex xs4 sm2 lg1">
<div class="d-flex justify--center">
<div>
<va-progress-circle indeterminate/>
</div>
</div>
</div>
</div>

<div class="row">
<div v-for="n in 10" :key="n" class="flex xs4 sm2 lg1">
<div class="d-flex justify--center">
Expand Down
15 changes: 10 additions & 5 deletions src/components/statistics/progress-bars/Widgets/ColorfulBars.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@
:title="$t('progressBars.colors')"
>
<div class="row">
<div v-for="n in 3" :key="n" class="flex md3 xs12">
<div v-for="n in 6" :key="n" class="flex md4 xs12">
<va-progress-bar
:value="value * n / 4"
:value="value * n / 6"
:color="colors[n - 1]"
>{{ colors[n - 1] }}
</va-progress-bar>
</div>
<div class="flex md3 xs12">
<va-progress-bar indeterminate color="black">Black</va-progress-bar>
<div v-for="n in 6" :key="n" class="flex md2 xs6">
<va-progress-circle
class="ma-auto"
:value="value * n / 6"
:color="colors[n - 1]"
>{{ colors[n - 1] }}
</va-progress-circle>
</div>
</div>
</va-card>
Expand All @@ -23,7 +28,7 @@ export default {
data () {
return {
value: 0,
colors: ['danger', 'success', 'warning'],
colors: ['danger', 'success', 'info', 'gray', 'warning', 'black'],
}
},
mounted () {
Expand Down
46 changes: 4 additions & 42 deletions src/components/statistics/progress-bars/Widgets/HorizontalBars.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,10 @@
<va-progress-bar :value="value / 3"/>
</div>
<div class="flex md4 xs12">
<va-progress-bar :value="bufferValues.value" :buffer="bufferValues.buffer"/>
<va-progress-bar :value="value2"/>
</div>
<div class="flex md4 xs12">
<va-progress-bar indeterminate/>
</div>
</div>
<div class="row">
<div class="flex md4 xs12">
<va-progress-bar :value="value * 2 / 3">66%</va-progress-bar>
</div>
<div class="flex md4 xs12">
<va-progress-bar
:value="bufferValues.value"
:buffer="bufferValues.buffer"
>Buffering
</va-progress-bar>
</div>
<div class="flex md4 xs12">
<va-progress-bar indeterminate>Loading...</va-progress-bar>
<va-progress-bar :value="value3"/>
</div>
</div>
</va-card>
Expand All @@ -38,32 +23,9 @@ export default {
data () {
return {
value: 0,
bufferValues: {
value: 0,
buffer: 0,
},
value2: 66,
value3: 100,
}
},
mounted () {
this.animateValue()
this.animateBufferValues()
},
methods: {
animateValue () {
setTimeout(() => {
this.value = 100
})
},
animateBufferValues () {
const interval = setInterval(() => {
this.bufferValues.value += 2 + Math.floor(Math.random() * 2)
this.bufferValues.buffer += 2 + Math.floor(Math.random() * 4)
if (this.bufferValues.value >= 100) {
clearInterval(interval)
}
}, 400)
},
},
}
</script>

0 comments on commit ff7cf04

Please sign in to comment.