mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 07:25:44 +01:00
use reflow to migrate from flow to typescript
This commit is contained in:
33
scm-ui/ui-components/src/forms/LabelWithHelpIcon.tsx
Normal file
33
scm-ui/ui-components/src/forms/LabelWithHelpIcon.tsx
Normal file
@@ -0,0 +1,33 @@
|
||||
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;
|
||||
Reference in New Issue
Block a user