From 6f7e0c75b464cb0adf9890c31900b6689c8ec988 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Fri, 24 Sep 2021 11:43:28 -0500 Subject: [PATCH] RegistrationForm: refactor isOpen logic --- .../components/registration_form.js | 23 +--------------- app/soapbox/features/landing_page/index.js | 26 ++++++++++++++++++- 2 files changed, 26 insertions(+), 23 deletions(-) diff --git a/app/soapbox/features/auth_login/components/registration_form.js b/app/soapbox/features/auth_login/components/registration_form.js index 3e3fb9b1b..c0021d3df 100644 --- a/app/soapbox/features/auth_login/components/registration_form.js +++ b/app/soapbox/features/auth_login/components/registration_form.js @@ -140,32 +140,11 @@ class RegistrationForm extends ImmutablePureComponent { render() { const { instance, intl, supportsEmailList } = this.props; const { params } = this.state; - const isOpen = instance.get('registrations'); const isLoading = this.state.captchaLoading || this.state.submissionLoading; - if (isOpen === false) { - return ( -
-

- -

-
- {instance.get('title')} }} - /> -
-
- ); - } - return ( -
+
({ class LandingPage extends ImmutablePureComponent { + renderClosed = () => { + const { instance } = this.props; + + return ( +
+

+ +

+
+ {instance.get('title')} }} + /> +
+
+ ); + } + render() { const { instance } = this.props; + const isOpen = instance.get('registrations', false) === true; return (
@@ -28,7 +52,7 @@ class LandingPage extends ImmutablePureComponent {
- + {isOpen ? : this.renderClosed()}