diff --git a/packages/ui/alert.tsx b/packages/ui/alert.tsx new file mode 100644 index 0000000..a9759a7 --- /dev/null +++ b/packages/ui/alert.tsx @@ -0,0 +1,43 @@ +import { cn } from './utils'; +import type { VariantProps } from 'class-variance-authority'; +import { cva } from 'class-variance-authority'; +import type { HTMLAttributes } from 'react'; +import { forwardRef } from 'react'; + +const variants = cva('flex p-4 mb-4 text-s rounded-md', { + defaultVariants: { + color: 'default', + }, + variants: { + color: { + danger: 'border-red-300 bg-red-50 p-4 text-sm text-red-800', + default: 'border-blue-300 bg-blue-50 p-4 text-sm text-blue-800', + success: 'border-green-300 bg-green-50 p-4 text-sm text-green-800', + warning: 'border-yellow-300 bg-yellow-50 p-4 text-sm text-yellow-800', + }, + }, +}); + +export type AlertProps = HTMLAttributes & + VariantProps & { readonly description?: string; readonly title: string }; + +export const Alert = forwardRef( + ({ className, color, description, title, ...props }, ref) => ( +
+ + Info +
+ {title} + {description &&
{description}
} +
+
+ ) +); diff --git a/packages/ui/index.tsx b/packages/ui/index.tsx index 8206500..0c3b334 100644 --- a/packages/ui/index.tsx +++ b/packages/ui/index.tsx @@ -1,3 +1,4 @@ +export * from './alert'; export * from './background'; export * from './button'; export * from './checkbox';