Skip to content

Commit 826cdc1

Browse files
committed
Modified a inside alert to inherit color
1 parent f0c6345 commit 826cdc1

File tree

2 files changed

+39
-8
lines changed

2 files changed

+39
-8
lines changed

src/components/Feedback/Alerts/Alerts.stories.tsx

Lines changed: 30 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import type { Meta, StoryObj } from "@storybook/react";
2-
import { Alert } from "flowbite-react";
2+
import { Alert, AlertProps } from "flowbite-react";
3+
import { FC } from "react";
4+
import { Link } from "../../Typography";
5+
6+
type ContentProps = { color: AlertProps["color"] };
7+
const Content: FC<ContentProps> = ({ color }) => {
8+
return (
9+
<>
10+
{color}: Lorem ipsum dolor,{" "}
11+
<Link href="#">sit amet consectetur adipisicing elit.</Link>
12+
</>
13+
);
14+
};
315

416
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
517
const meta: Meta<typeof Alert> = {
@@ -15,10 +27,22 @@ const meta: Meta<typeof Alert> = {
1527
args: {},
1628
render: ({ children, ...args }) => (
1729
<div className="space-y-2">
18-
<Alert {...args} color={"info"} children={"Info: " + children} />
19-
<Alert {...args} color={"warning"} children={"Warning: " + children} />
20-
<Alert {...args} color={"failure"} children={"Failure: " + children} />
21-
<Alert {...args} color={"success"} children={"Success: " + children} />
30+
<Alert {...args} color={"info"} children={<Content color={"info"} />} />
31+
<Alert
32+
{...args}
33+
color={"warning"}
34+
children={<Content color={"warning"} />}
35+
/>
36+
<Alert
37+
{...args}
38+
color={"failure"}
39+
children={<Content color={"failure"} />}
40+
/>
41+
<Alert
42+
{...args}
43+
color={"success"}
44+
children={<Content color={"success"} />}
45+
/>
2246
</div>
2347
),
2448
};
@@ -29,7 +53,5 @@ type Story = StoryObj<typeof Alert>;
2953
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
3054
export const Message: Story = {
3155
// More on args: https://storybook.js.org/docs/react/writing-stories/args
32-
args: {
33-
children: "Lorem ipsum dolor, sit amet consectetur adipisicing elit.",
34-
},
56+
args: {},
3557
};

src/main.css

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,12 @@
3737
display: none;
3838
}
3939
}
40+
41+
/** Components */
42+
43+
:is(.dark [role="alert"]),
44+
[role="alert"] {
45+
a {
46+
color: inherit;
47+
}
48+
}

0 commit comments

Comments
 (0)