opnform-host-nginx/client/components/global/Steps.vue

59 lines
1.4 KiB
Vue
Raw Normal View History

2023-12-09 15:47:03 +01:00
<template>
<div
class="py-4"
:class="{ 'border-b-2': borderBottom }"
>
<div
class="uppercase tracking-wide text-xs font-bold dark:text-gray-400 text-gray-500 mb-1 leading-tight"
>
2023-12-09 15:47:03 +01:00
Step: {{ Math.min(current + 1, steps.length) }} of {{ steps.length }}
</div>
<div class="flex flex-col md:flex-row md:items-center md:justify-between">
<div class="flex-1">
<div
class="text-lg font-bold dark:text-gray-300 text-gray-700 leading-tight"
>
{{ steps[current] ? steps[current] : "Complete!" }}
2023-12-09 15:47:03 +01:00
</div>
</div>
<div class="flex items-center md:w-64">
<div class="w-full bg-gray-100 dark:bg-gray-700 rounded-full mr-2">
<div
class="rounded-full bg-nt-blue text-xs leading-none h-2 text-center text-white transition-all"
:style="{
width: parseInt((current / steps.length) * 100) + '%',
'min-width': '8px',
}"
2023-12-09 15:47:03 +01:00
/>
</div>
<div
class="text-xs w-10 text-gray-600 dark:text-gray-400"
v-text="parseInt((current / steps.length) * 100) + '%'"
/>
2023-12-09 15:47:03 +01:00
</div>
</div>
</div>
</template>
<script>
export default {
name: "Steps",
2023-12-09 15:47:03 +01:00
props: {
steps: {
type: Array,
required: true,
2023-12-09 15:47:03 +01:00
},
borderBottom: {
type: Boolean,
default: true,
2023-12-09 15:47:03 +01:00
},
current: {
type: Number,
default: 0,
},
},
2023-12-09 15:47:03 +01:00
}
</script>