From fa240261ec8dd3ac3aba9d2d3d20cf3bb2e70280 Mon Sep 17 00:00:00 2001 From: Yoga Pangestu Date: Sat, 25 Jul 2026 12:34:20 +0700 Subject: [PATCH] feat: add Alert, AlertDescription, and AlertTitle components with variant support --- app/components/ui/alert/Alert.vue | 21 +++++++++++++++++ app/components/ui/alert/AlertDescription.vue | 17 ++++++++++++++ app/components/ui/alert/AlertTitle.vue | 17 ++++++++++++++ app/components/ui/alert/index.ts | 24 ++++++++++++++++++++ 4 files changed, 79 insertions(+) create mode 100644 app/components/ui/alert/Alert.vue create mode 100644 app/components/ui/alert/AlertDescription.vue create mode 100644 app/components/ui/alert/AlertTitle.vue create mode 100644 app/components/ui/alert/index.ts diff --git a/app/components/ui/alert/Alert.vue b/app/components/ui/alert/Alert.vue new file mode 100644 index 0000000..a9d336f --- /dev/null +++ b/app/components/ui/alert/Alert.vue @@ -0,0 +1,21 @@ + + + diff --git a/app/components/ui/alert/AlertDescription.vue b/app/components/ui/alert/AlertDescription.vue new file mode 100644 index 0000000..652f332 --- /dev/null +++ b/app/components/ui/alert/AlertDescription.vue @@ -0,0 +1,17 @@ + + + diff --git a/app/components/ui/alert/AlertTitle.vue b/app/components/ui/alert/AlertTitle.vue new file mode 100644 index 0000000..b218384 --- /dev/null +++ b/app/components/ui/alert/AlertTitle.vue @@ -0,0 +1,17 @@ + + + diff --git a/app/components/ui/alert/index.ts b/app/components/ui/alert/index.ts new file mode 100644 index 0000000..42d07b6 --- /dev/null +++ b/app/components/ui/alert/index.ts @@ -0,0 +1,24 @@ +import type { VariantProps } from "class-variance-authority" +import { cva } from "class-variance-authority" + +export { default as Alert } from "./Alert.vue" +export { default as AlertDescription } from "./AlertDescription.vue" +export { default as AlertTitle } from "./AlertTitle.vue" + +export const alertVariants = cva( + "relative w-full rounded-lg border px-4 py-3 text-sm grid has-[>svg]:grid-cols-[calc(var(--spacing)*4)_1fr] grid-cols-[0_1fr] has-[>svg]:gap-x-3 gap-y-0.5 items-start [&>svg]:size-4 [&>svg]:translate-y-0.5 [&>svg]:text-current", + { + variants: { + variant: { + default: "bg-card text-card-foreground", + destructive: + "text-destructive bg-card [&>svg]:text-current *:data-[slot=alert-description]:text-destructive/90", + }, + }, + defaultVariants: { + variant: "default", + }, + }, +) + +export type AlertVariants = VariantProps