mirror of
https://github.com/empayre/fleet.git
synced 2024-11-07 09:18:59 +00:00
dc4b97d15f
- Refactor imports of PropTypes to use the prop-types package - Upgrade dependencies that were setting off deprecation warnings
41 lines
915 B
JavaScript
41 lines
915 B
JavaScript
import React, { Component } from 'react';
|
|
import PropTypes from 'prop-types';
|
|
import classnames from 'classnames';
|
|
|
|
import Icon from 'components/icons/Icon';
|
|
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 (
|
|
<Icon
|
|
className={iconClasses}
|
|
fw={fw}
|
|
name={iconName}
|
|
size={size}
|
|
title={title}
|
|
/>
|
|
);
|
|
}
|
|
}
|
|
|
|
export default PlatformIcon;
|