Files
SCM-Manager/scm-ui/ui-components/src/Icon.js

30 lines
638 B
JavaScript
Raw Normal View History

2019-06-12 15:22:10 +02:00
//@flow
import React from "react";
import classNames from "classnames";
type Props = {
title?: string,
name: string,
color: string,
className?: string
};
2019-06-12 15:22:10 +02:00
export default class Icon extends React.Component<Props> {
static defaultProps = {
color: "grey-light"
};
2019-06-12 15:22:10 +02:00
render() {
const { title, name, color, className } = this.props;
if (title) {
2019-06-12 15:22:10 +02:00
return (
<i
title={title}
className={classNames("fas", "fa-fw", "fa-" + name, `has-text-${color}`, className)}
/>
2019-06-12 15:22:10 +02:00
);
}
2019-09-19 08:59:03 +02:00
return <i className={classNames("fas", "fa-" + name, `has-text-${color}`, className)} />;
2019-06-12 15:22:10 +02:00
}
}