diff --git a/src/components/Alert/Alert.tsx b/src/components/Alert/Alert.tsx
index cd46a05..1ed0aeb 100644
--- a/src/components/Alert/Alert.tsx
+++ b/src/components/Alert/Alert.tsx
@@ -1,5 +1,5 @@
import "./alert.css";
-import { CSSProperties } from "react";
+import { CSSProperties, ReactNode } from "react";
interface CustomStyleCSS extends CSSProperties {
"--codex-border-radius"?: string;
@@ -11,7 +11,9 @@ interface CustomStyleCSS extends CSSProperties {
type Props = {
variant: "success" | "warning" | "toast";
- message: string;
+ title: string;
+
+ children: ReactNode;
className?: string;
@@ -23,12 +25,16 @@ type Props = {
* --codex-font-family
*/
style?: CustomStyleCSS;
+
+ Icon?: ReactNode;
};
export function Alert({
variant,
- message,
style,
+ title,
+ Icon,
+ children,
className = "",
...rest
}: Props) {
@@ -38,8 +44,16 @@ export function Alert({
style={style}
{...rest}
>
- {variant} !
-
{message}
+ {Icon && (
+
+ {Icon}
+
+ )}
+
+
);
}
diff --git a/src/components/Alert/alert.css b/src/components/Alert/alert.css
index 3eaa176..445330f 100644
--- a/src/components/Alert/alert.css
+++ b/src/components/Alert/alert.css
@@ -1,23 +1,42 @@
.alert {
- border: 1px solid var(--codex-alert-border-color);
- color: 1px solid var(--codex-alert-border-color);
+ border-top: 2px solid rgb(var(--codex-alert-color));
+ background-color: rgba(var(--codex-alert-color), 0.1);
+ color: 1px solid var(--codex-alert-color);
border-radius: var(--codex-border-radius);
padding: 0.75rem 1.5rem;
font-family: var(--codex-font-family);
- color: var(--codex-alert-color);
+ color: var(--codex-color);
word-break: break-word;
+ display: flex;
+ gap: 1rem;
}
-.alert-message {
+.alert-icon {
+ display: flex;
+ width: 1rem;
+ color: rgb(var(--codex-alert-color));
+}
+
+.alert-circleIcon {
+ background: rgba(var(--codex-alert-color), 0.2);
+ border-radius: 75px;
+ height: 1.75rem;
+ width: 1.75rem;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+}
+
+.alert-title {
text-transform: capitalize;
+ margin-bottom: 0.25rem;
+ display: inline-block;
}
.alert--success {
- --codex-alert-border-color: var(--codex-color-primary);
- --codex-alert-color: var(--codex-color-primary);
+ --codex-alert-color: var(--codex-color-success);
}
.alert--warning {
- --codex-alert-border-color: var(--codex-color-warning);
--codex-alert-color: var(--codex-color-warning);
}
diff --git a/stories/Alert.stories.ts b/stories/Alert.stories.tsx
similarity index 61%
rename from stories/Alert.stories.ts
rename to stories/Alert.stories.tsx
index 056800a..c678715 100644
--- a/stories/Alert.stories.ts
+++ b/stories/Alert.stories.tsx
@@ -1,5 +1,6 @@
import type { Meta, StoryObj } from "@storybook/react";
import { Alert } from "../src/components/Alert/Alert";
+import { AlertCircle, CircleIcon, InfoIcon } from "lucide-react";
const meta = {
title: "Overlays/Alert",
@@ -20,21 +21,33 @@ type Story = StoryObj;
export const Success: Story = {
args: {
- message: "This is a success message.",
+ title: "Success",
+ children: "This is a success message.",
variant: "success",
},
};
export const Warning: Story = {
args: {
- message: "This is a warning message.",
+ children: "This is a warning message.",
variant: "warning",
+ title: "Warning",
+ },
+};
+
+export const Icon: Story = {
+ args: {
+ Icon: ,
+ children: "This is a warning message.",
+ variant: "success",
+ title: "Success",
},
};
export const CustomStyle: Story = {
args: {
- message: "This is a custom style message.",
+ title: "Warning",
+ children: "This is a custom style message.",
variant: "warning",
style: { "--codex-color-warning": "red" },
},