fleet/frontend/components/icons/PlatformIcon/PlatformIcon.jsx
Zachary Wasserman dc4b97d15f
Fix React deprecation warnings (#1976)
- Refactor imports of PropTypes to use the prop-types package
- Upgrade dependencies that were setting off deprecation warnings
2019-01-06 17:25:33 -08:00

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;