diff --git a/app/gabsocial/features/forms/index.js b/app/gabsocial/features/forms/index.js
index 973994fa8..c92e2ead6 100644
--- a/app/gabsocial/features/forms/index.js
+++ b/app/gabsocial/features/forms/index.js
@@ -28,18 +28,33 @@ InputContainer.propTypes = {
extraClass: PropTypes.string,
};
-export const LabelInput = ({ label, ...props }) => {
+export const LabelInputContainer = ({ label, children, ...props }) => {
const id = uuidv4();
+ const childrenWithProps = React.Children.map(children, child => (
+ React.cloneElement(child, { id: id })
+ ));
+
return (
);
};
+LabelInputContainer.propTypes = {
+ label: PropTypes.string.isRequired,
+ children: PropTypes.node,
+};
+
+export const LabelInput = ({ label, ...props }) => (
+
+
+
+);
+
LabelInput.propTypes = {
label: PropTypes.string.isRequired,
};
@@ -64,46 +79,26 @@ export class SimpleInput extends ImmutablePureComponent {
}
-export class SimpleForm extends ImmutablePureComponent {
+export const SimpleForm = ({ children, onSubmit }) => (
+
+);
- static propTypes = {
- children: PropTypes.node,
- onSubmit: PropTypes.func,
- }
+SimpleForm.propTypes = {
+ children: PropTypes.node,
+ onSubmit: PropTypes.func,
+};
- static defaultProps = {
- onSubmit: e => e.preventDefault(),
- }
+SimpleForm.defaultProps = {
+ onSubmit: e => e.preventDefault(),
+};
- render() {
- const { children, onSubmit } = this.props;
+export const FieldsGroup = ({ children }) => (
+ {children}
+);
- return (
-
- );
- }
-
-}
-
-export class FieldsGroup extends ImmutablePureComponent {
-
- static propTypes = {
- children: PropTypes.node,
- }
-
- render() {
- const { children } = this.props;
-
- return (
-
- {children}
-
- );
- }
-
-}
+FieldsGroup.propTypes = {
+ children: PropTypes.node,
+};
export const Checkbox = props => (
@@ -126,7 +121,7 @@ export class RadioGroup extends ImmutablePureComponent {
return (
@@ -150,20 +145,13 @@ export class RadioItem extends ImmutablePureComponent {
}
render() {
- const { label, hint, value, checked, onChange } = this.props;
+ const { label, hint, ...props } = this.props;
const id = uuidv4();
return (
@@ -177,35 +165,20 @@ export class SelectDropdown extends ImmutablePureComponent {
static propTypes = {
label: PropTypes.string,
items: PropTypes.object.isRequired,
- defaultValue: PropTypes.string,
- onChange: PropTypes.func,
}
render() {
- const { label, items, defaultValue, onChange } = this.props;
- const id = uuidv4();
+ const { label, items, ...props } = this.props;
- return (
-
-
-
-
-
-
-
-
- );
+ const optionElems = Object.keys(items).map(item => (
+
+ ));
+
+ const selectElem = ;
+
+ return label ? (
+ {selectElem}
+ ) : selectElem;
}
}