Skip to content

Commit c3ea7c8

Browse files
crhuff-ibmtay1orjoneskodiakhq[bot]
authored
fix: make ActionableNotification subtitle proptypes node to allow objects (#13821)
* fix: make notification subtitle proptypes node to allow objects * fix: publicAPI snap * feat(notification): only render action button when label is provided * chore: update snapshot * fix(notification): make actionButtonLabel optional --------- Co-authored-by: Taylor Jones <taylor.jones826@gmail.com> Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 6b9c00e commit c3ea7c8

2 files changed

Lines changed: 10 additions & 9 deletions

File tree

packages/react/__tests__/__snapshots__/PublicAPI-test.js.snap

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ Map {
108108
},
109109
"propTypes": Object {
110110
"actionButtonLabel": Object {
111-
"isRequired": true,
112111
"type": "string",
113112
},
114113
"aria-label": Object {
@@ -166,7 +165,7 @@ Map {
166165
"type": "string",
167166
},
168167
"subtitle": Object {
169-
"type": "string",
168+
"type": "node",
170169
},
171170
"title": Object {
172171
"type": "string",

packages/react/src/components/Notification/Notification.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,7 @@ export interface ActionableNotificationProps
822822
/**
823823
* Pass in the action button label that will be rendered within the ActionableNotification.
824824
*/
825-
actionButtonLabel: string;
825+
actionButtonLabel?: string;
826826

827827
/**
828828
* Provide a description for "close" icon button that can be read by screen readers
@@ -905,7 +905,7 @@ export interface ActionableNotificationProps
905905
/**
906906
* Specify the subtitle
907907
*/
908-
subtitle?: string;
908+
subtitle?: ReactNode;
909909

910910
/**
911911
* Specify the title
@@ -1001,9 +1001,11 @@ export function ActionableNotification({
10011001
</div>
10021002
</div>
10031003

1004-
<NotificationActionButton onClick={onActionButtonClick} inline={inline}>
1005-
{actionButtonLabel}
1006-
</NotificationActionButton>
1004+
{actionButtonLabel && (
1005+
<NotificationActionButton onClick={onActionButtonClick} inline={inline}>
1006+
{actionButtonLabel}
1007+
</NotificationActionButton>
1008+
)}
10071009

10081010
{!hideCloseButton && (
10091011
<NotificationButton
@@ -1020,7 +1022,7 @@ ActionableNotification.propTypes = {
10201022
/**
10211023
* Pass in the action button label that will be rendered within the ActionableNotification.
10221024
*/
1023-
actionButtonLabel: PropTypes.string.isRequired,
1025+
actionButtonLabel: PropTypes.string,
10241026

10251027
/**
10261028
* Provide a description for "close" icon button that can be read by screen readers
@@ -1112,7 +1114,7 @@ ActionableNotification.propTypes = {
11121114
/**
11131115
* Specify the subtitle
11141116
*/
1115-
subtitle: PropTypes.string,
1117+
subtitle: PropTypes.node,
11161118

11171119
/**
11181120
* Specify the title

0 commit comments

Comments
 (0)