import React from 'react'; import { shape, number, string, bool, func } from 'prop-types'; import { I18n } from '@lingui/react'; import { t } from '@lingui/macro'; import { Link } from 'react-router-dom'; import { Badge, Switch, DataListItem, DataListItemRow, DataListItemCells, DataListCell, } from '@patternfly/react-core'; function NotificationListItem (props) { const { canToggleNotifications, notification, detailUrl, successTurnedOn, errorTurnedOn, toggleNotification } = props; const capText = { textTransform: 'capitalize' }; return ( {({ i18n }) => ( {notification.name} {notification.notification_type} , toggleNotification( notification.id, successTurnedOn, 'success' )} aria-label={i18n._(t`Toggle notification success`)} /> toggleNotification( notification.id, errorTurnedOn, 'error' )} aria-label={i18n._(t`Toggle notification failure`)} /> ]} /> )} ); } NotificationListItem.propTypes = { notification: shape({ id: number.isRequired, name: string.isRequired, notification_type: string.isRequired, }).isRequired, canToggleNotifications: bool.isRequired, detailUrl: string.isRequired, errorTurnedOn: bool, successTurnedOn: bool, toggleNotification: func.isRequired, }; NotificationListItem.defaultProps = { errorTurnedOn: false, successTurnedOn: false, }; export default NotificationListItem;