Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make it easier to reorder fields in the sign up form #296

Closed
rishabhpoddar opened this issue Jul 22, 2021 · 2 comments
Closed

Make it easier to reorder fields in the sign up form #296

rishabhpoddar opened this issue Jul 22, 2021 · 2 comments

Comments

@rishabhpoddar
Copy link
Contributor

rishabhpoddar commented Jul 22, 2021

Related to conversation https://discord.com/channels/603466164219281420/644849840475602944/867716322334867476

At the moment, we need to use @emotion/react for it and need to override the sign up component and do:

css={{
  form: {
    display: "flex",
    flexDirection: "column",
    "& > div:nth-of-type(3)": { // first name field (for example)
      order: -1
    },
  }
}}>

This is annoying and unclear. We would ideally like an API like:

signUpForm: {
   formFields: [
      {
         id: "name",
         label: "Full Name",
         placeholder: "e.g Jane Doe"
       },
       {
          id: "email"
       },
       {
          id: "password"
       }
   ],
},

Notice that we do not have to provide any other field in the email and password objects. Just their ids.

@nickmanks
Copy link

Just tried this and it worked nicely for me:

EmailPasswordSignUp_Override: ({ DefaultComponent, ...props }) => {
      return (
              <DefaultComponent
                    {...props}
                    formFields={[
                       props.formFields.find(({id}) => id === 'name'),
                       props.formFields.find(({id}) => id === 'email'),
                       props.formFields.find(({id}) => id === 'password'),
                    ]}
              />
       );
},

@rishabhpoddar
Copy link
Contributor Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants