1 | import { __rest } from "tslib";
|
2 | import * as React from 'react';
|
3 | import { Button, ButtonVariant } from '../Button';
|
4 | import { css } from '@patternfly/react-styles';
|
5 | import styles from '@patternfly/react-styles/css/components/NotificationBadge/notification-badge';
|
6 | import AttentionBellIcon from '@patternfly/react-icons/dist/esm/icons/attention-bell-icon';
|
7 | import BellIcon from '@patternfly/react-icons/dist/esm/icons/bell-icon';
|
8 | export var NotificationBadgeVariant;
|
9 | (function (NotificationBadgeVariant) {
|
10 | NotificationBadgeVariant["read"] = "read";
|
11 | NotificationBadgeVariant["unread"] = "unread";
|
12 | NotificationBadgeVariant["attention"] = "attention";
|
13 | })(NotificationBadgeVariant || (NotificationBadgeVariant = {}));
|
14 | export const NotificationBadge = (_a) => {
|
15 | var { isRead, children, variant = isRead ? 'read' : 'unread', count = 0, attentionIcon = React.createElement(AttentionBellIcon, null), icon = React.createElement(BellIcon, null), className } = _a, props = __rest(_a, ["isRead", "children", "variant", "count", "attentionIcon", "icon", "className"]);
|
16 | let notificationChild = icon;
|
17 | if (children !== undefined) {
|
18 | notificationChild = children;
|
19 | }
|
20 | else if (variant === NotificationBadgeVariant.attention) {
|
21 | notificationChild = attentionIcon;
|
22 | }
|
23 | return (React.createElement(Button, Object.assign({ variant: ButtonVariant.plain, className: className }, props),
|
24 | React.createElement("span", { className: css(styles.notificationBadge, styles.modifiers[variant]) },
|
25 | notificationChild,
|
26 | count > 0 && React.createElement("span", { className: css(styles.notificationBadgeCount) }, count))));
|
27 | };
|
28 | NotificationBadge.displayName = 'NotificationBadge';
|
29 |
|
\ | No newline at end of file |