hezarfen_frontend
Clone
https://git.tahinli.com/archive/hezarfen_frontend.git
0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits
| 1 | import type { ComponentProps, ParentProps } from "solid-js"; |
| 2 | import { splitProps } from "solid-js"; |
| 3 | import { cn } from "@/lib/cn"; |
| 4 | |
| 5 | export function Alert( |
| 6 | props: ParentProps<ComponentProps<"div"> & { variant?: "default" | "destructive" | "success" | "warning" | "info" }>, |
| 7 | ) { |
| 8 | const [local, rest] = splitProps(props, ["class", "children", "variant"]); |
| 9 | return ( |
| 10 | <div |
| 11 | role="alert" |
| 12 | class={cn( |
| 13 | "relative flex min-h-[70px] w-full items-center rounded-lg border px-5 py-4 text-sm", |
| 14 | local.variant === "destructive" && "border-destructive/30 bg-destructive/10 text-destructive-text", |
| 15 | local.variant === "success" && "border-success/30 bg-success/10 font-medium text-success-text", |
| 16 | local.variant === "warning" && "border-warning/30 bg-warning/10 font-medium text-warning-text", |
| 17 | local.variant === "info" && "border-info/30 bg-info/10 font-medium text-info-text", |
| 18 | (!local.variant || local.variant === "default") && "border-border-line bg-surface-base text-foreground", |
| 19 | local.class, |
| 20 | )} |
| 21 | {...rest} |
| 22 | > |
| 23 | {local.children} |
| 24 | </div> |
| 25 | ); |
| 26 | } |