Skip to content

Commit 0264dea

Browse files
authored
23479: Added Progress component, Updated contrast of links in alerts (#94)
1 parent b5c49a6 commit 0264dea

File tree

7 files changed

+87
-8
lines changed

7 files changed

+87
-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
};
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
import type { Meta, StoryObj } from "@storybook/react";
2+
import { Progress } from "./Progress";
3+
4+
// More on how to set up stories at: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
5+
const meta: Meta<typeof Progress> = {
6+
component: Progress,
7+
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/7.0/react/writing-docs/docs-page
8+
tags: ["autodocs"],
9+
parameters: {
10+
// More on Story layout: https://storybook.js.org/docs/react/configure/story-layout
11+
layout: "centered",
12+
},
13+
// More on argTypes: https://storybook.js.org/docs/react/api/argtypes
14+
argTypes: {},
15+
args: {
16+
progress: 50,
17+
},
18+
};
19+
20+
export default meta;
21+
type Story = StoryObj<typeof Progress>;
22+
23+
// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
24+
export const Default: Story = {
25+
// More on args: https://storybook.js.org/docs/react/writing-stories/args
26+
args: {
27+
className: "w-[50vw]",
28+
},
29+
};
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import {
2+
Progress as FlowbiteProgress,
3+
ProgressProps as FlowbiteProgressProps,
4+
} from "flowbite-react";
5+
import { FC } from "react";
6+
7+
export type ProgressProps = FlowbiteProgressProps;
8+
export const Progress: FC<ProgressProps> = ({
9+
color = "primary",
10+
...props
11+
}) => <FlowbiteProgress {...props} color={color} />;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from "./Progress";

src/components/Feedback/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ export * from "./ErrorBoundary";
99
export * from "./ErrorGraphic";
1010
export * from "./GraphicalError";
1111
export * from "./NoResultsAlert";
12+
export * from "./Progress";
1213
export * from "./Skeleton";
1314
export * from "./TextScramble";
1415

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+
}

src/themes/standard.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,12 @@ export const standardFlowbiteTheme: CustomFlowbiteTheme = {
253253
},
254254
},
255255
},
256+
progress: {
257+
color: {
258+
default: "bg-primary-600",
259+
primary: "bg-primary-600",
260+
},
261+
},
256262
select: {
257263
field: {
258264
select: {

0 commit comments

Comments
 (0)