fix: clip progress bar width to 100% (#892)

* fix: course progress bar should not go beyond 100% width

* refactor: progress bar component should include outer body div
This commit is contained in:
Md Hussain Nagaria
2024-06-26 00:29:55 +05:30
committed by GitHub
parent d4a15ade98
commit 326c77cdb9
3 changed files with 35 additions and 18 deletions

View File

@@ -0,0 +1,24 @@
<template>
<div class="w-full bg-gray-200 rounded-full h-1 my-2">
<div
class="bg-gray-900 h-1 rounded-full"
:style="{ width: progressBarWidth }"
></div>
</div>
</template>
<script setup>
import { computed } from 'vue'
const props = defineProps({
progress: {
type: Number,
default: 0,
},
})
const progressBarWidth = computed(() => {
const formattedPercentage = Math.min(Math.ceil(props.progress), 100)
return `${formattedPercentage}%`
})
</script>