summaryrefslogtreecommitdiffstats
path: root/src/ui/objects/Alert.tsx
diff options
context:
space:
mode:
authorVolpeon <git@volpeon.ink>2026-07-22 19:40:59 +0200
committerVolpeon <git@volpeon.ink>2026-07-22 19:40:59 +0200
commitc1e28224aa2e1450031669d9a7e359b63e04687d (patch)
tree68f3d8905c763a91f68001d868197effa92adafa /src/ui/objects/Alert.tsx
downloadcorvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.gz
corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.tar.bz2
corvos-website-c1e28224aa2e1450031669d9a7e359b63e04687d.zip
Init
Diffstat (limited to 'src/ui/objects/Alert.tsx')
-rw-r--r--src/ui/objects/Alert.tsx21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/ui/objects/Alert.tsx b/src/ui/objects/Alert.tsx
new file mode 100644
index 0000000..f590e18
--- /dev/null
+++ b/src/ui/objects/Alert.tsx
@@ -0,0 +1,21 @@
1import type { HTMLTag, Polymorphic } from "corvos/plugins/jsx.ts";
2
3export type Props<Tag extends HTMLTag> = Polymorphic<{
4 as?: Tag;
5 icon?: JSX.Element;
6 variant?: "accent" | "positive" | "negative" | "warning";
7}>;
8
9export const Alert = <T extends HTMLTag = "div">({
10 children,
11 as: Tag = "div" as T,
12 variant,
13 icon,
14 class: cls,
15 ...props
16}: Props<T>) => (
17 <Tag class:list={["o-alert", { [`o-alert--${variant}`]: variant }, cls]} {...props}>
18 {icon && <span class="u-mie-100">{icon}</span>}
19 {children}
20 </Tag>
21);