From 1c087fae322a1b07bb7bd554ee10ff473c47c727 Mon Sep 17 00:00:00 2001
From: Fin Reinhard <fin.reinhard@icloud.com>
Date: Tue, 22 Jan 2019 20:51:03 +0000
Subject: [PATCH] Merge branch 'master' into feature/15-archive-view-url
---
borgbutler-webapp/src/components/general/forms/FormComponents.jsx | 20 +++++++++++++++-----
1 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/borgbutler-webapp/src/components/general/forms/FormComponents.jsx b/borgbutler-webapp/src/components/general/forms/FormComponents.jsx
index 4d8f4d0..32a84ff 100644
--- a/borgbutler-webapp/src/components/general/forms/FormComponents.jsx
+++ b/borgbutler-webapp/src/components/general/forms/FormComponents.jsx
@@ -3,8 +3,9 @@
import classNames from 'classnames';
import {FormFeedback, Input, UncontrolledTooltip} from 'reactstrap';
import {FormCheckbox} from "./FormCheckbox";
+import {FormRadioButton} from "./FormRadioButton";
import {FormButton} from "./FormButton";
-import {FormSelect, FormOption} from "./FormSelect";
+import {FormOption, FormSelect} from "./FormSelect";
import {revisedRandId} from "../../../utilities/global";
import I18n from "../translation/I18n";
@@ -80,10 +81,14 @@
</UncontrolledTooltip>;
}
const {fieldLength, className, hint, hintPlacement, id, ...other} = props;
+ let myClassName = className;
+ if (fieldLength > 0) {
+ myClassName = classNames(`col-sm-${props.fieldLength}`, className);
+ }
return (
<React.Fragment>
<Input id={targetId}
- className={classNames(`col-sm-${props.fieldLength}`, className)}
+ className={myClassName}
{...other}
/>
{tooltip}
@@ -113,7 +118,6 @@
name: '',
hint: null,
hintPlacement: 'top',
- fieldLength: 10,
value: '',
min: null,
max: null,
@@ -158,9 +162,9 @@
const FormLabelField = (props) => {
- const forId = props.children.props.id || props.htmlFor || revisedRandId();
+ const forId = props.children.props.id || props.children.props.name || props.htmlFor || revisedRandId();
return (
- <FormGroup>
+ <FormGroup className={props.className}>
<FormLabel length={props.labelLength} htmlFor={forId}>
{props.label}
</FormLabel>
@@ -173,6 +177,7 @@
FormLabelField.propTypes = {
id: PropTypes.string,
+ className: PropTypes.string,
htmlFor: PropTypes.string,
validationMessage: PropTypes.string,
labelLength: PropTypes.number,
@@ -184,6 +189,7 @@
FormLabelField.defaultProps = {
id: null,
+ className: null,
htmlFor: null,
validationMessage: null,
labelLength: 2,
@@ -202,6 +208,7 @@
label={props.label}
hint={props.hint}
validationState={props.validationState}
+ className={props.className}
>
<FormInput
id={props.id}
@@ -224,6 +231,7 @@
FormLabelInputField.propTypes = {
id: PropTypes.string,
label: PropTypes.node,
+ className: PropTypes.node,
labelLength: PropTypes.number,
fieldLength: PropTypes.number,
hint: PropTypes.string,
@@ -241,6 +249,7 @@
FormLabelInputField.defaultProps = {
id: null,
+ className: null,
label: '',
labelLength: 2,
fieldLength: 10,
@@ -291,6 +300,7 @@
FormSelect,
FormOption,
FormCheckbox,
+ FormRadioButton,
FormLabelInputField,
FormFieldset,
FormButton,
--
Gitblit v1.10.0