From 5a75cdee7af1c50b96d993c611830eebc9a9968b Mon Sep 17 00:00:00 2001 From: jenny-s51 Date: Fri, 28 Apr 2023 11:46:00 -0400 Subject: [PATCH] add event param to onClose --- .../NotificationDrawer/NotificationDrawerHeader.tsx | 4 ++-- .../examples/NotificationDrawerBasic.tsx | 4 ++-- .../examples/NotificationDrawerLightweight.tsx | 4 ++-- .../demos/NotificationDrawer/NotificationDrawer.md | 12 ++++++------ .../AlertGroupToastWithNotificationDrawer.tsx | 2 +- .../NotificationDrawerBasicDemo.tsx | 4 ++-- .../NotificationDrawerGroupsDemo.tsx | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/packages/react-core/src/components/NotificationDrawer/NotificationDrawerHeader.tsx b/packages/react-core/src/components/NotificationDrawer/NotificationDrawerHeader.tsx index 4bf83e79d2e..1e54aea890a 100644 --- a/packages/react-core/src/components/NotificationDrawer/NotificationDrawerHeader.tsx +++ b/packages/react-core/src/components/NotificationDrawer/NotificationDrawerHeader.tsx @@ -19,7 +19,7 @@ export interface NotificationDrawerHeaderProps extends React.HTMLProps void; + onClose?: (event: KeyboardEvent | React.MouseEvent) => void; /** Notification drawer heading title */ title?: string; /** Notification drawer heading unread text used in combination with a count */ @@ -49,7 +49,7 @@ export const NotificationDrawerHeader: React.FunctionComponent - diff --git a/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerBasic.tsx b/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerBasic.tsx index 690b0872d81..549a22f1d2c 100644 --- a/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerBasic.tsx +++ b/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerBasic.tsx @@ -29,7 +29,7 @@ export const NotificationDrawerBasic: React.FunctionComponent = () => { setIsOpenMap(new Array(7).fill(false)); }; - const onDrawerClose = () => { + const onDrawerClose = (_event: React.MouseEvent | KeyboardEvent) => { setIsOpenMap(new Array(7).fill(false)); }; @@ -47,7 +47,7 @@ export const NotificationDrawerBasic: React.FunctionComponent = () => { ]; return ( - + onDrawerClose(event)}> } diff --git a/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx b/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx index 71d8c687c9a..25263a10f49 100644 --- a/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx +++ b/packages/react-core/src/components/NotificationDrawer/examples/NotificationDrawerLightweight.tsx @@ -43,13 +43,13 @@ export const NotificationDrawerLightweight: React.FunctionComponent = () => { setFirstGroupExpanded(false); }; - const onDrawerClose = () => { + const onDrawerClose = (_event: KeyboardEvent | React.MouseEvent) => { // do something cool in a callback }; return ( - + onDrawerClose(event)} /> { + this.onCloseNotificationDrawer = (_event) => { this.setState((prevState) => { return { isDrawerExpanded: !prevState.isDrawerExpanded @@ -258,7 +258,7 @@ class BasicNotificationDrawer extends React.Component { this.onCloseNotificationDrawer(event)} aria-label="Notifications" isExpanded={isDrawerExpanded} > @@ -385,7 +385,7 @@ class BasicNotificationDrawer extends React.Component { const notificationDrawer = ( - + this.onCloseNotificationDrawer(event)}> { + this.onCloseNotificationDrawer = (_event) => { this.setState((prevState) => { return { isDrawerExpanded: !prevState.isDrawerExpanded @@ -860,7 +860,7 @@ class GroupedNotificationDrawer extends React.Component { this.onCloseNotificationDrawer(event)} aria-label="Notifications" isExpanded={isDrawerExpanded} > @@ -987,7 +987,7 @@ class GroupedNotificationDrawer extends React.Component { const notificationDrawer = ( - + this.onCloseNotificationDrawer(event)}> - setDrawerExpanded(false)}> + setDrawerExpanded(false)}> { + onDrawerClose = (_event: KeyboardEvent | React.MouseEvent) => { this.setState({ isDrawerOpen: false }); @@ -63,7 +63,7 @@ export class BasicNotificationDrawerDemo extends React.Component< ]; return ( - + this.onDrawerClose(event)}> } diff --git a/packages/react-integration/demo-app-ts/src/components/demos/NotificationDrawerDemo/NotificationDrawerGroupsDemo.tsx b/packages/react-integration/demo-app-ts/src/components/demos/NotificationDrawerDemo/NotificationDrawerGroupsDemo.tsx index 15a90e664f4..1ad60ababa6 100644 --- a/packages/react-integration/demo-app-ts/src/components/demos/NotificationDrawerDemo/NotificationDrawerGroupsDemo.tsx +++ b/packages/react-integration/demo-app-ts/src/components/demos/NotificationDrawerDemo/NotificationDrawerGroupsDemo.tsx @@ -53,7 +53,7 @@ export class GroupsNotificationDrawerDemo extends React.Component< }; } - onDrawerClose = () => { + onDrawerClose = (_event: KeyboardEvent | React.MouseEvent) => { this.setState({ isDrawerOpen: false }); @@ -99,7 +99,7 @@ export class GroupsNotificationDrawerDemo extends React.Component< ]; return ( - + this.onDrawerClose(event)}>