Skip to content

Commit ca7af4d

Browse files
committed
feat: add ability to change height of the progress bar
1 parent dfc6421 commit ca7af4d

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

adminforth/spa/src/afcl/ProgressBar.vue

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
11
<template>
2-
<div class="relative w-full max-w-[700px] bg-lightProgressBarUnfilledColor rounded-full h-2.5 dark:bg-darkProgressBarUnfilledColor">
2+
<div class="relative w-full max-w-[700px] bg-lightProgressBarUnfilledColor rounded-full h-2.5 dark:bg-darkProgressBarUnfilledColor" :class="props.height ? `h-${props.height}` : ''">
33
<span class="absolute -top-6 left-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ leftLabel }}</span>
44
<span class="absolute -top-6 right-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ rightLabel }}</span>
55
<div
66
class="bg-lightProgressBarFilledColor dark:bg-darkProgressBarFilledColor h-2.5 rounded-full transition-all duration-300 ease-in-out"
7-
:class="{ 'progress-bar': showAnimation }"
7+
:class="{ 'progress-bar': showAnimation, [`h-${props.height}`]: props.height }"
88
:style="{ width: `${percentage}%` }"
99
></div>
10-
<span v-if="showValues" class="absolute top-4 left-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ formatValue(minValue) }}</span>
11-
<span v-if="showProgress" class="absolute top-4 right-1/2 translate-x-1/2 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ progressText }}</span>
12-
<span v-if="showValues" class="absolute top-4 right-0 text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ formatValue(maxValue) }}</span>
10+
<div class="flex justify-between mt-2">
11+
<span v-if="showValues" class="text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ formatValue(minValue) }}</span>
12+
<span v-if="showProgress" class="text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ progressText }}</span>
13+
<span v-if="showValues" class="text-sm text-lightProgressBarText dark:text-darkProgressBarText">{{ formatValue(maxValue) }}</span>
14+
</div>
1315
</div>
1416
</template>
1517

@@ -28,6 +30,7 @@ interface Props {
2830
showValues?: boolean
2931
showProgress?: boolean
3032
showAnimation?: boolean
33+
height?: number
3134
}
3235
3336
const props = withDefaults(defineProps<Props>(), {

0 commit comments

Comments
 (0)