forge
Explore
Log in

Don't you dare go Hollow

hezarfen_frontend

Clone
★ 0

0 watching0 forksTypeScript5.5 MiB5fcd955Burak Boduroğlu2 months ago730 commits

alert.tsx26 lines, 1.1 KiBHistoryRawDownload
1import type { ComponentProps, ParentProps } from "solid-js";
2import { splitProps } from "solid-js";
3import { cn } from "@/lib/cn";
4
5export 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}