File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ interface Props {
3+ variant: ' warning' | ' error'
4+ icon? : string
5+ title? : string
6+ }
7+
8+ defineProps <Props >()
9+
10+ const variantClasses: Record <Props [' variant' ], string > = {
11+ warning: ' border-amber-400/20 bg-amber-500/8' ,
12+ error: ' border-red-400/20 bg-red-500/8' ,
13+ }
14+
15+ const iconClasses: Record <Props [' variant' ], string > = {
16+ warning: ' text-amber-400/80' ,
17+ error: ' text-red-400/80' ,
18+ }
19+ </script >
20+
21+ <template >
22+ <div role =" alert" class =" border rounded-md px-3 py-2.5" :class =" variantClasses[variant]" >
23+ <p v-if =" icon || title" class =" flex items-center gap-1.5 text-sm font-medium text-fg mb-1" >
24+ <span
25+ v-if =" icon"
26+ :class =" [`i-lucide:${icon}`, 'w-3.5 h-3.5 shrink-0', iconClasses[variant]]"
27+ aria-hidden =" true"
28+ />
29+ {{ title }}
30+ </p >
31+ <div class =" text-sm text-fg-muted" >
32+ <slot />
33+ </div >
34+ </div >
35+ </template >
You can’t perform that action at this time.
0 commit comments