mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 08:25:44 +01:00
add help to input field
This commit is contained in:
@@ -8,7 +8,8 @@ const styles = {
|
|||||||
display: "block"
|
display: "block"
|
||||||
},
|
},
|
||||||
q: {
|
q: {
|
||||||
float: "left"
|
float: "left",
|
||||||
|
paddingLeft: "3px"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
//@flow
|
//@flow
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import {Help, Page} from "../index";
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
label?: string,
|
label?: string,
|
||||||
@@ -12,7 +13,8 @@ type Props = {
|
|||||||
onReturnPressed?: () => void,
|
onReturnPressed?: () => void,
|
||||||
validationError: boolean,
|
validationError: boolean,
|
||||||
errorMessage: string,
|
errorMessage: string,
|
||||||
disabled?: boolean
|
disabled?: boolean,
|
||||||
|
helpText?: string
|
||||||
};
|
};
|
||||||
|
|
||||||
class InputField extends React.Component<Props> {
|
class InputField extends React.Component<Props> {
|
||||||
@@ -41,6 +43,17 @@ class InputField extends React.Component<Props> {
|
|||||||
return "";
|
return "";
|
||||||
};
|
};
|
||||||
|
|
||||||
|
renderHelp = () => {
|
||||||
|
const helpText = this.props.helpText;
|
||||||
|
if(helpText){
|
||||||
|
return (
|
||||||
|
<div className="control columns is-vcentered">
|
||||||
|
<Help message={helpText} />
|
||||||
|
</div>);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
handleKeyPress = (event: SyntheticKeyboardEvent<HTMLInputElement>) => {
|
handleKeyPress = (event: SyntheticKeyboardEvent<HTMLInputElement>) => {
|
||||||
const onReturnPressed = this.props.onReturnPressed;
|
const onReturnPressed = this.props.onReturnPressed;
|
||||||
@@ -71,7 +84,8 @@ class InputField extends React.Component<Props> {
|
|||||||
return (
|
return (
|
||||||
<div className="field">
|
<div className="field">
|
||||||
{this.renderLabel()}
|
{this.renderLabel()}
|
||||||
<div className="control">
|
<div className="field is-grouped">
|
||||||
|
<div className="control is-expanded">
|
||||||
<input
|
<input
|
||||||
ref={input => {
|
ref={input => {
|
||||||
this.field = input;
|
this.field = input;
|
||||||
@@ -85,6 +99,8 @@ class InputField extends React.Component<Props> {
|
|||||||
disabled={disabled}
|
disabled={disabled}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
{this.renderHelp()}
|
||||||
|
</div>
|
||||||
{helper}
|
{helper}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -41,6 +41,7 @@ class GeneralSettings extends React.Component<Props> {
|
|||||||
onChange={this.handleRealmDescriptionChange}
|
onChange={this.handleRealmDescriptionChange}
|
||||||
value={realmDescription}
|
value={realmDescription}
|
||||||
disabled={!hasUpdatePermission}
|
disabled={!hasUpdatePermission}
|
||||||
|
helpText={"hallo"}
|
||||||
/>
|
/>
|
||||||
<InputField
|
<InputField
|
||||||
label={t("general-settings.date-format")}
|
label={t("general-settings.date-format")}
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class Config extends React.Component<Props> {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<Page>
|
<Page>
|
||||||
<Help message={"Hallo"} />
|
|
||||||
<div className="columns">
|
<div className="columns">
|
||||||
<div className="column is-three-quarters">
|
<div className="column is-three-quarters">
|
||||||
<Route path={url} exact component={GlobalConfig} />
|
<Route path={url} exact component={GlobalConfig} />
|
||||||
|
|||||||
Reference in New Issue
Block a user