This commit is contained in:
MrYpma 2024-12-20 18:11:28 +02:00 committed by GitHub
commit dc0f3d2ded
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 5 additions and 3 deletions

View File

@ -44,6 +44,6 @@ import { Progress } from '@/components/ui/progress'
</script>
<template>
<Progress :model-value="33" />
<Progress :model-value="33" :max="50" />
</template>
```

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)}%);`"
:style="`transform: translateX(-${100 - (props.modelValue ?? 0) * 100 / props.max}%);`"
/>
</ProgressRoot>
</template>

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)}%);`"
:style="`transform: translateX(-${100 - (props.modelValue ?? 0) * 100 / props.max}%);`"
/>
</ProgressRoot>
</template>