refactor: tests and results section

This commit is contained in:
liyasthomas
2021-07-31 00:51:41 +05:30
parent a1eac2f348
commit 2904084853
6 changed files with 167 additions and 82 deletions

View File

@@ -0,0 +1,55 @@
<template>
<svg :height="radius * 2" :width="radius * 2">
<circle
:stroke-width="stroke"
class="stroke-green-500"
fill="transparent"
:r="normalizedRadius"
:cx="radius"
:cy="radius"
/>
<circle
:stroke-width="stroke"
stroke="currentColor"
fill="transparent"
:r="normalizedRadius"
:cx="radius"
:cy="radius"
:style="{ strokeDashoffset: strokeDashoffset }"
:stroke-dasharray="circumference + ' ' + circumference"
/>
</svg>
</template>
<script>
export default {
props: {
radius: {
type: Number,
default: 12,
},
progress: {
type: Number,
default: 50,
},
stroke: {
type: Number,
default: 4,
},
},
data() {
const normalizedRadius = this.radius - this.stroke * 2
const circumference = normalizedRadius * 2 * Math.PI
return {
normalizedRadius,
circumference,
}
},
computed: {
strokeDashoffset() {
return this.circumference - (this.progress / 100) * this.circumference
},
},
}
</script>