mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
49e71e4ed6
- 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.
41 lines
933 B
JavaScript
41 lines
933 B
JavaScript
import React, { Component } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classnames from 'classnames';
|
|
|
|
import KolideIcon from 'components/icons/KolideIcon';
|
|
import platformIconClass from 'utilities/platform_icon_class';
|
|
|
|
const baseClass = 'platform-icon';
|
|
|
|
export class PlatformIcon extends Component {
|
|
static propTypes = {
|
|
className: PropTypes.string,
|
|
fw: PropTypes.bool,
|
|
name: PropTypes.string.isRequired,
|
|
size: PropTypes.string,
|
|
title: PropTypes.string,
|
|
};
|
|
|
|
render () {
|
|
const { className, name, fw, size, title } = this.props;
|
|
const iconClasses = classnames(baseClass, className);
|
|
let iconName = platformIconClass(name);
|
|
|
|
if (!iconName) {
|
|
iconName = 'single-host';
|
|
}
|
|
|
|
return (
|
|
<KolideIcon
|
|
className={iconClasses}
|
|
fw={fw}
|
|
name={iconName}
|
|
size={size}
|
|
title={title}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default PlatformIcon;
|