Skip to content

fix(Alert): remove redundant boolean from onDismiss prop type #1539

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .changeset/yummy-feet-attend.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"flowbite-react": patch
---

refactor(Alert): `onDismiss` prop

- Changed the type of `onDismiss` prop in Alert component from boolean to a function type
- Removed `onDismiss` default values from various Alert stories to align with the updated prop type
5 changes: 0 additions & 5 deletions apps/storybook/src/Alert.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ const Template: StoryFn<AlertProps> = (props) => <Alert {...props} />;
export const DefaultAlert = Template.bind({});
DefaultAlert.storyName = "Default";
DefaultAlert.args = {
onDismiss: false,
children: (
<>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Soluta minima rerum veritatis optio atque impedit, enim
Expand All @@ -32,7 +31,6 @@ export const AlertWithIcons = Template.bind({});
AlertWithIcons.storyName = "With icons";
AlertWithIcons.args = {
icon: HiInformationCircle,
onDismiss: false,
children: (
<>
More info about this info alert goes here. This example text is going to run a bit longer so that you can see how
Expand All @@ -54,15 +52,13 @@ AlertRounded.storyName = "Not rounded";
AlertRounded.args = {
color: "warning",
rounded: false,
onDismiss: false,
children: <>Info alert! Change a few things up and try submitting again.</>,
};

export const AlertWithBorderAccent = Template.bind({});
AlertWithBorderAccent.storyName = "Border accent";
AlertWithBorderAccent.args = {
color: "warning",
onDismiss: false,
withBorderAccent: true,
children: <>Info alert! Change a few things up and try submitting again.</>,
};
Expand All @@ -72,7 +68,6 @@ AlertWithAdditionalContent.storyName = "Additional content";
AlertWithAdditionalContent.args = {
color: "info",
icon: HiInformationCircle,
onDismiss: false,
withBorderAccent: true,
additionalContent: (
<>
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -141,5 +141,5 @@
"default": true
}
},
"required": ["components", "path", "prefix", "rsc", "tsx"]
"required": ["components", "dark", "path", "prefix", "rsc", "tsx"]
}
2 changes: 1 addition & 1 deletion packages/ui/src/components/Alert/Alert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export interface AlertProps extends Omit<ComponentProps<"div">, "color">, Themin
additionalContent?: ReactNode;
color?: DynamicStringEnumKeysOf<FlowbiteColors>;
icon?: FC<ComponentProps<"svg">>;
onDismiss?: boolean | (() => void);
onDismiss?: ComponentProps<"button">["onClick"];
rounded?: boolean;
withBorderAccent?: boolean;
}
Expand Down
Loading