mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-08 22:45:45 +01:00
expand Icon component and use it in HelpIcon, .is-icon class is redundant
This commit is contained in:
@@ -1,22 +1,24 @@
|
||||
//@flow
|
||||
import React from "react";
|
||||
import injectSheet from "react-jss";
|
||||
import classNames from "classnames";
|
||||
import Icon from "./Icon";
|
||||
|
||||
type Props = {
|
||||
classes: any
|
||||
};
|
||||
|
||||
const styles = {
|
||||
textinfo: {
|
||||
color: "#98d8f3 !important"
|
||||
}
|
||||
textinfo: {
|
||||
color: "#98d8f3 !important"
|
||||
}
|
||||
};
|
||||
|
||||
class HelpIcon extends React.Component<Props> {
|
||||
render() {
|
||||
const { classes } = this.props;
|
||||
return <i className={classNames("fa fa-question-circle has-text-info", classes.textinfo)}></i>;
|
||||
return (
|
||||
<Icon className={classes.textinfo} name="question-circle" />
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4,22 +4,26 @@ import classNames from "classnames";
|
||||
|
||||
type Props = {
|
||||
title?: string,
|
||||
name: string
|
||||
}
|
||||
name: string,
|
||||
color: string,
|
||||
className?: string
|
||||
};
|
||||
|
||||
export default class Icon extends React.Component<Props> {
|
||||
static defaultProps = {
|
||||
color: "grey-light"
|
||||
};
|
||||
|
||||
render() {
|
||||
const { title, name } = this.props;
|
||||
if(title) {
|
||||
const { title, name, color, className } = this.props;
|
||||
if (title) {
|
||||
return (
|
||||
<i title={title} className={classNames("is-icon", "fas", "fa-fw", "fa-" + name)}/>
|
||||
<i
|
||||
title={title}
|
||||
className={classNames("fas", "fa-fw", "fa-" + name, `has-text-${color}`, className)}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<i className={classNames("is-icon", "fas", "fa-" + name)}/>
|
||||
);
|
||||
return <i className={classNames("fas", "fa-" + name, `has-text-${color}`)} />;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@ import classNames from "classnames";
|
||||
|
||||
type Props = {
|
||||
className?: string,
|
||||
color?: string,
|
||||
color: string,
|
||||
icon?: string,
|
||||
label: string,
|
||||
title?: string,
|
||||
|
||||
Reference in New Issue
Block a user