@patternfly/react-core#AlertActionCloseButton JavaScript Examples
The following examples show how to use
@patternfly/react-core#AlertActionCloseButton.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Notifications.js From sed-frontend with Apache License 2.0 | 6 votes |
Notifications = () => {
const { notifications, removeNotification } = useNotifications();
return (
<AlertGroup isToast>
{notifications.map((notification, i) => (
<Alert
isLiveRegion
timeout={notification.timeout}
title={notification.message}
variant={notification.variant}
key={notification.key}
actionClose={
<AlertActionCloseButton
data-testid={`notification-close-btn-${i}`}
title={notification.message}
variantLabel={`${notification.variant} alert`}
onClose={() => {
removeNotification(notification.key);
if (notification?.downloadHref) {
window.URL.revokeObjectURL(notification.downloadHref);
}
}}
/>
}
/>
))}
</AlertGroup>
);
}
Example #2
Source File: app.jsx From cockpit-certificates with GNU Lesser General Public License v2.1 | 5 votes |
render() {
const { certmongerService, startErrorMessage, cas, certs, toExpireCerts, expiredCerts } = this.state;
if (expiredCerts > 0) {
page_status.set_own({
type: "error",
title: cockpit.format(cockpit.ngettext("$0 certificate has expired",
"$0 certificates have expired",
expiredCerts), expiredCerts),
details: []
});
} else if (toExpireCerts > 0) {
page_status.set_own({
type: "warning",
title: cockpit.format(cockpit.ngettext("$0 certificate expires soon",
"$0 certificates expire soon",
toExpireCerts), toExpireCerts),
details: []
});
}
const certificatesBody = (
<CertificateList cas={cas} certs={certs} addAlert={this.addAlert} appOnValueChanged={this.onValueChanged} />
);
const emptyStateBody = (
<EmptyState service={ certmongerService }
serviceName={ CERTMONGER_SERVICE_NAME }
errorMessage={ startErrorMessage }
updateService={ () => this.updateCertmongerService() } />
);
const body = () => {
if (!certmongerService || !certmongerService.exists || !certmongerService.state || certmongerService.state !== "running")
return emptyStateBody;
return certificatesBody;
};
return (
<Page>
<PageSection variant={PageSectionVariants.light}>
{ body() }
<AlertGroup isToast>
{this.state.alerts.map((danger, index) => (
<Alert isLiveRegion
variant={AlertVariant.danger}
title={danger.title}
actionClose={
<AlertActionCloseButton variantLabel="danger alert"
onClose={() => this.removeAlert(index)} />
}
key={index}>
{_("Error message: ") + danger.message}
</Alert>
))}
</AlertGroup>
</PageSection>
</Page>
);
}