From 752682b936298409b5f82ccec74d3a889cd87d34 Mon Sep 17 00:00:00 2001 From: WK Wong Date: Fri, 10 Jan 2025 18:50:50 +0800 Subject: [PATCH 1/3] fix(avatar): title type in Avatar --- .changeset/quick-peas-care.md | 5 +++++ apps/docs/content/docs/components/alert.mdx | 2 +- packages/components/alert/src/use-alert.ts | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 .changeset/quick-peas-care.md diff --git a/.changeset/quick-peas-care.md b/.changeset/quick-peas-care.md new file mode 100644 index 0000000000..5c453cbb55 --- /dev/null +++ b/.changeset/quick-peas-care.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/alert": patch +--- + +fix title type in Avatar (#4525) diff --git a/apps/docs/content/docs/components/alert.mdx b/apps/docs/content/docs/components/alert.mdx index 49000c2744..f7cf045722 100644 --- a/apps/docs/content/docs/components/alert.mdx +++ b/apps/docs/content/docs/components/alert.mdx @@ -138,7 +138,7 @@ Alert has the following slots: data={[ { attribute: "title", - type: "string", + type: "ReactNode", description: "The alert title", default: "-" }, diff --git a/packages/components/alert/src/use-alert.ts b/packages/components/alert/src/use-alert.ts index 5c24fd1e03..1f45f1863d 100644 --- a/packages/components/alert/src/use-alert.ts +++ b/packages/components/alert/src/use-alert.ts @@ -17,7 +17,7 @@ interface Props extends HTMLNextUIProps<"div"> { /** * title of the alert message */ - title?: string; + title?: ReactNode; /** * description of the alert message */ From a17f27beafbfb2ac1570e88cdeff5e3f0cafa541 Mon Sep 17 00:00:00 2001 From: WK Wong Date: Fri, 10 Jan 2025 18:58:20 +0800 Subject: [PATCH 2/3] fix(alert): apply isEmpty check on title --- packages/components/alert/src/alert.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/alert/src/alert.tsx b/packages/components/alert/src/alert.tsx index 2504a65829..5e4e8d9752 100644 --- a/packages/components/alert/src/alert.tsx +++ b/packages/components/alert/src/alert.tsx @@ -62,7 +62,7 @@ const Alert = forwardRef<"div", AlertProps>((props, ref) => { {customIcon || }
- {title &&
{title}
} + {!isEmpty(title) &&
{title}
} {!isEmpty(description) &&
{description}
} {children}
From 2930ad2ca58a38970d43def79ac95faccabd5e3d Mon Sep 17 00:00:00 2001 From: WK Wong Date: Fri, 10 Jan 2025 19:05:28 +0800 Subject: [PATCH 3/3] fix(alert): alert interface props type --- packages/components/alert/src/use-alert.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/components/alert/src/use-alert.ts b/packages/components/alert/src/use-alert.ts index 1f45f1863d..c5e45456c1 100644 --- a/packages/components/alert/src/use-alert.ts +++ b/packages/components/alert/src/use-alert.ts @@ -9,7 +9,7 @@ import {alert} from "@nextui-org/theme"; import {useControlledState} from "@react-stately/utils"; import {dataAttr, isEmpty, objectToDeps} from "@nextui-org/shared-utils"; -interface Props extends HTMLNextUIProps<"div"> { +interface Props extends Omit, "title"> { /** * Ref to the DOM node. */