diff --git a/app/gabsocial/features/forms/index.js b/app/gabsocial/features/forms/index.js index 7cb91cc36..fed8deb8e 100644 --- a/app/gabsocial/features/forms/index.js +++ b/app/gabsocial/features/forms/index.js @@ -79,18 +79,32 @@ export class SimpleInput extends ImmutablePureComponent { } -export const SimpleForm = ({ children, ...props }) => ( -
{children}
-); +export class SimpleForm extends ImmutablePureComponent { -SimpleForm.propTypes = { - children: PropTypes.node, -}; + static propTypes = { + children: PropTypes.node, + }; -SimpleForm.defaultProps = { - acceptCharset: 'UTF-8', - onSubmit: e => e.preventDefault(), -}; + static defaultProps = { + acceptCharset: 'UTF-8', + onSubmit: e => {}, + }; + + onSubmit = e => { + this.props.onSubmit(e); + e.preventDefault(); + } + + render() { + const { children, onSubmit, ...props } = this.props; + return ( +
+ {children} +
+ ); + } + +} export const FieldsGroup = ({ children }) => (
{children}
diff --git a/app/gabsocial/features/landing_page/components/registration_form.js b/app/gabsocial/features/landing_page/components/registration_form.js index 21eba9750..c50abecfc 100644 --- a/app/gabsocial/features/landing_page/components/registration_form.js +++ b/app/gabsocial/features/landing_page/components/registration_form.js @@ -23,7 +23,6 @@ class RegistrationForm extends ImmutablePureComponent { onSubmit = e => { // TODO: Dispatch action - e.preventDefault(); } render() {