mirror of
https://github.com/fleetdm/fleet
synced 2026-04-21 13:37:30 +00:00
- Add new PNG files for the new icons in the left side navigation and the right side labels on the Hosts page. - Rename the old `<Icon />` component to `<KolideIcon />` and create a new `<Icon />` component. The ultimate goal is to get rid of the `<KolideIcon />` and `<PlatformIcon />` components and use the encompassing `<Icon />` component for all icons. The full transition will be made when we have icon assets to replace all the kolide icons and platform icons. Currently, we don't. - Rename the `icon_name_for_label.js` utility to `icon_name.js` because the utility now includes `iconNameForLabel()` and `iconNameForPlatform()` functions. - Fixes issue #127.
58 lines
1.6 KiB
JavaScript
58 lines
1.6 KiB
JavaScript
import React from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classnames from 'classnames';
|
|
|
|
import notificationInterface from 'interfaces/notification';
|
|
import KolideIcon from 'components/icons/KolideIcon';
|
|
import Button from 'components/buttons/Button';
|
|
|
|
const baseClass = 'flash-message';
|
|
|
|
const FlashMessage = ({ fullWidth, notification, onRemoveFlash, onUndoActionClick }) => {
|
|
const { alertType, isVisible, message, undoAction } = notification;
|
|
const klass = classnames(baseClass, `${baseClass}--${alertType}`, {
|
|
[`${baseClass}--full-width`]: fullWidth,
|
|
});
|
|
|
|
if (!isVisible) {
|
|
return false;
|
|
}
|
|
|
|
const alertIcon = alertType === 'success' ? 'success-check' : 'warning-filled';
|
|
|
|
return (
|
|
<div className={klass}>
|
|
<div className={`${baseClass}__content`}>
|
|
<KolideIcon name={alertIcon} /> <span>{message}</span>
|
|
|
|
{undoAction &&
|
|
<Button
|
|
className={`${baseClass}__undo`}
|
|
variant="unstyled"
|
|
onClick={onUndoActionClick(undoAction)}
|
|
>
|
|
Undo
|
|
</Button>
|
|
}
|
|
</div>
|
|
<div className={`${baseClass}__action`}>
|
|
<Button
|
|
className={`${baseClass}__remove ${baseClass}__remove--${alertType}`}
|
|
variant="unstyled"
|
|
onClick={onRemoveFlash}
|
|
>
|
|
<KolideIcon name="x" />
|
|
</Button>
|
|
</div>
|
|
</div>
|
|
);
|
|
};
|
|
|
|
FlashMessage.propTypes = {
|
|
fullWidth: PropTypes.bool,
|
|
notification: notificationInterface,
|
|
onRemoveFlash: PropTypes.func,
|
|
onUndoActionClick: PropTypes.func,
|
|
};
|
|
|
|
export default FlashMessage;
|