Skip to content

Commit fcdf24a

Browse files
authored
fix(avatar): title type in Avatar (#4529)
* fix(avatar): title type in Avatar * fix(alert): apply isEmpty check on title * fix(alert): alert interface props type
1 parent cfff127 commit fcdf24a

File tree

4 files changed

+9
-4
lines changed

4 files changed

+9
-4
lines changed

.changeset/quick-peas-care.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@nextui-org/alert": patch
3+
---
4+
5+
fix title type in Avatar (#4525)

apps/docs/content/docs/components/alert.mdx

+1-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ Alert has the following slots:
138138
data={[
139139
{
140140
attribute: "title",
141-
type: "string",
141+
type: "ReactNode",
142142
description: "The alert title",
143143
default: "-"
144144
},

packages/components/alert/src/alert.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ const Alert = forwardRef<"div", AlertProps>((props, ref) => {
6262
{customIcon || <IconComponent {...getAlertIconProps()} />}
6363
</div>
6464
<div {...getMainWrapperProps()}>
65-
{title && <div {...getTitleProps()}>{title}</div>}
65+
{!isEmpty(title) && <div {...getTitleProps()}>{title}</div>}
6666
{!isEmpty(description) && <div {...getDescriptionProps()}>{description}</div>}
6767
{children}
6868
</div>

packages/components/alert/src/use-alert.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@ import {alert} from "@nextui-org/theme";
99
import {useControlledState} from "@react-stately/utils";
1010
import {clsx, dataAttr, isEmpty, objectToDeps} from "@nextui-org/shared-utils";
1111

12-
interface Props extends HTMLNextUIProps<"div"> {
12+
interface Props extends Omit<HTMLNextUIProps<"div">, "title"> {
1313
/**
1414
* Ref to the DOM node.
1515
*/
1616
ref?: ReactRef<HTMLDivElement | null>;
1717
/**
1818
* title of the alert message
1919
*/
20-
title?: string;
20+
title?: ReactNode;
2121
/**
2222
* description of the alert message
2323
*/

0 commit comments

Comments
 (0)