feat(ui) : error toasts persist until dismissed, add progress bar on auto-dismiss toasts
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
]"
|
||||
>
|
||||
<div
|
||||
class="alert toast-card shadow-md px-3 py-2 text-sm"
|
||||
class="alert toast-card relative shadow-md px-3 py-2 text-sm overflow-hidden"
|
||||
:class="getToastClasses(toast.type)"
|
||||
>
|
||||
<div class="flex items-center gap-2">
|
||||
@@ -54,6 +54,13 @@
|
||||
<IconLucideX class="w-3 h-3" aria-hidden="true" />
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<!-- Progress bar for auto-dismiss toasts -->
|
||||
<div
|
||||
v-if="toast.duration > 0"
|
||||
class="absolute bottom-0 left-0 h-0.5 bg-current opacity-30 rounded-full"
|
||||
:style="{ animation: `toast-progress ${toast.duration}ms linear forwards` }"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</TransitionGroup>
|
||||
@@ -111,4 +118,9 @@ const getToastClasses = (type) => {
|
||||
pointer-events: auto;
|
||||
border-radius: 0.75rem;
|
||||
}
|
||||
|
||||
@keyframes toast-progress {
|
||||
from { width: 100%; }
|
||||
to { width: 0%; }
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user