Skip to content
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
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface NotificationDrawerHeaderProps extends React.HTMLProps<HTMLDivEl
/** Notification drawer heading custom text which can be used instead of providing count/unreadText */
customText?: string;
/** Callback for when close button is clicked */
onClose?: () => void;
onClose?: (event: KeyboardEvent | React.MouseEvent) => void;
/** Notification drawer heading title */
title?: string;
/** Notification drawer heading unread text used in combination with a count */
Expand Down Expand Up @@ -49,7 +49,7 @@ export const NotificationDrawerHeader: React.FunctionComponent<NotificationDrawe
{children}
{onClose && (
<div>
<Button variant={ButtonVariant.plain} aria-label={closeButtonAriaLabel} onClick={onClose}>
<Button variant={ButtonVariant.plain} aria-label={closeButtonAriaLabel} onClick={(event) => onClose(event)}>
<TimesIcon aria-hidden="true" />
</Button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const NotificationDrawerBasic: React.FunctionComponent = () => {
setIsOpenMap(new Array(7).fill(false));
};

const onDrawerClose = () => {
const onDrawerClose = (_event: React.MouseEvent<Element, MouseEvent> | KeyboardEvent) => {
setIsOpenMap(new Array(7).fill(false));
};

Expand All @@ -47,7 +47,7 @@ export const NotificationDrawerBasic: React.FunctionComponent = () => {
];
return (
<NotificationDrawer>
<NotificationDrawerHeader count={3} onClose={onDrawerClose}>
<NotificationDrawerHeader count={3} onClose={(event) => onDrawerClose(event)}>
<DropdownDeprecated
onSelect={onSelect}
toggle={<KebabToggle onToggle={onToggle(0)} id="basic-kebab-toggle" />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ export const NotificationDrawerLightweight: React.FunctionComponent = () => {
setFirstGroupExpanded(false);
};

const onDrawerClose = () => {
const onDrawerClose = (_event: KeyboardEvent | React.MouseEvent<Element, MouseEvent>) => {
// do something cool in a callback
};

return (
<NotificationDrawer>
<NotificationDrawerHeader onClose={onDrawerClose} />
<NotificationDrawerHeader onClose={(event) => onDrawerClose(event)} />
<NotificationDrawerBody>
<NotificationDrawerGroupList>
<NotificationDrawerGroup
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ class BasicNotificationDrawer extends React.Component {
});
};

this.onCloseNotificationDrawer = () => {
this.onCloseNotificationDrawer = (_event) => {
this.setState((prevState) => {
return {
isDrawerExpanded: !prevState.isDrawerExpanded
Expand Down Expand Up @@ -258,7 +258,7 @@ class BasicNotificationDrawer extends React.Component {
<ToolbarItem visibility={{ default: 'visible' }} isSelected={isDrawerExpanded}>
<NotificationBadge
variant={this.getNumberUnread() === 0 ? 'read' : 'unread'}
onClick={this.onCloseNotificationDrawer}
onClick={(event) => this.onCloseNotificationDrawer(event)}
aria-label="Notifications"
isExpanded={isDrawerExpanded}
>
Expand Down Expand Up @@ -385,7 +385,7 @@ class BasicNotificationDrawer extends React.Component {

const notificationDrawer = (
<NotificationDrawer ref={this.drawerRef}>
<NotificationDrawerHeader count={this.getNumberUnread()} onClose={this.onCloseNotificationDrawer}>
<NotificationDrawerHeader count={this.getNumberUnread()} onClose={(event) => this.onCloseNotificationDrawer(event)}>
<DropdownDeprecated
onSelect={this.onSelect}
toggle={
Expand Down Expand Up @@ -702,7 +702,7 @@ class GroupedNotificationDrawer extends React.Component {
});
};

this.onCloseNotificationDrawer = () => {
this.onCloseNotificationDrawer = (_event) => {
this.setState((prevState) => {
return {
isDrawerExpanded: !prevState.isDrawerExpanded
Expand Down Expand Up @@ -860,7 +860,7 @@ class GroupedNotificationDrawer extends React.Component {
<ToolbarItem visibility={{ default: 'visible' }} isSelected={isDrawerExpanded}>
<NotificationBadge
variant={this.getNumberUnread() === 0 ? 'read' : 'unread'}
onClick={this.onCloseNotificationDrawer}
onClick={(event) => this.onCloseNotificationDrawer(event)}
aria-label="Notifications"
isExpanded={isDrawerExpanded}
>
Expand Down Expand Up @@ -987,7 +987,7 @@ class GroupedNotificationDrawer extends React.Component {

const notificationDrawer = (
<NotificationDrawer ref={this.drawerRef}>
<NotificationDrawerHeader count={this.getNumberUnread()} onClose={this.onCloseNotificationDrawer}>
<NotificationDrawerHeader count={this.getNumberUnread()} onClose={(event) => this.onCloseNotificationDrawer(event)}>
<DropdownDeprecated
onSelect={this.onSelect}
toggle={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ export const AlertGroupToastWithNotificationDrawer: React.FunctionComponent = ()

const notificationDrawer = (
<NotificationDrawer>
<NotificationDrawerHeader count={getUnreadNotificationsNumber()} onClose={() => setDrawerExpanded(false)}>
<NotificationDrawerHeader count={getUnreadNotificationsNumber()} onClose={(_event) => setDrawerExpanded(false)}>
<DropdownDeprecated
onSelect={onDropdownSelect}
toggle={
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export class BasicNotificationDrawerDemo extends React.Component<
isOpen: new Array(6).fill(false)
};
}
onDrawerClose = () => {
onDrawerClose = (_event: KeyboardEvent | React.MouseEvent<Element, MouseEvent>) => {
this.setState({
isDrawerOpen: false
});
Expand Down Expand Up @@ -63,7 +63,7 @@ export class BasicNotificationDrawerDemo extends React.Component<
];
return (
<NotificationDrawer>
<NotificationDrawerHeader count={2} onClose={this.onDrawerClose}>
<NotificationDrawerHeader count={2} onClose={(event) => this.onDrawerClose(event)}>
<DropdownDeprecated
onSelect={this.onSelect}
toggle={<KebabToggle onToggle={this.onToggle(0)} id="toggle-id-0" />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export class GroupsNotificationDrawerDemo extends React.Component<
};
}

onDrawerClose = () => {
onDrawerClose = (_event: KeyboardEvent | React.MouseEvent<Element, MouseEvent>) => {
this.setState({
isDrawerOpen: false
});
Expand Down Expand Up @@ -99,7 +99,7 @@ export class GroupsNotificationDrawerDemo extends React.Component<
];
return (
<NotificationDrawer>
<NotificationDrawerHeader count={4} onClose={this.onDrawerClose}>
<NotificationDrawerHeader count={4} onClose={(event) => this.onDrawerClose(event)}>
<DropdownDeprecated
onSelect={this.onSelect}
toggle={
Expand Down