set max default in props declaration

This commit is contained in:
MrYpma 2024-11-13 22:56:41 +01:00 committed by GitHub
parent 7b85b4df47
commit 98cc62a110
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -11,6 +11,7 @@ const props = withDefaults(
defineProps<ProgressRootProps & { class?: HTMLAttributes['class'] }>(),
{
modelValue: 0,
max: 100
},
)
@ -33,7 +34,7 @@ const delegatedProps = computed(() => {
>
<ProgressIndicator
class="h-full w-full flex-1 bg-primary transition-all"
:style="`transform: translateX(-${100 - (props.modelValue ?? 0) * 100 / (props.max ?? 100)}%);`"
:style="`transform: translateX(-${100 - (props.modelValue ?? 0) * 100 / props.max}%);`"
/>
</ProgressRoot>
</template>