Files
SCM-Manager/scm-ui/ui-components/src/forms/LabelWithHelpIcon.tsx

34 lines
564 B
TypeScript
Raw Normal View History

import React from "react";
import Help from "../Help";
type Props = {
label?: string;
helpText?: string;
};
class LabelWithHelpIcon extends React.Component<Props> {
renderHelp() {
const { helpText } = this.props;
if (helpText) {
return <Help message={helpText} />;
}
}
render() {
const { label } = this.props;
if (label) {
const help = this.renderHelp();
return (
<label className="label">
{label} {help}
</label>
);
}
return "";
}
}
export default LabelWithHelpIcon;