Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Use Field component in auth flows #2749

Merged
merged 10 commits into from
Mar 6, 2019
Merged

Conversation

jryans
Copy link
Collaborator

@jryans jryans commented Mar 5, 2019

This changes to the Field component throughout the auth flows for consistent, modern visual styling.

Reviewer: Each commit in this PR is self-contained and has some additional context in the commit message, so you may want to review commit by commit.

2019-03-05 at 18 03

2019-03-05 at 18 02

2019-03-05 at 18 04

Fixes element-hq/element-web#8262

This converts most fields in the registration form to use the Field component,
except for the phone number, which is a left as a separate task because of the
country dropdown menu.
By placing the Field's border on the Field component root instead of the input,
it's easier to wrap it around additional elements that we'll soon stuff inside
the field.
This allows Fields to have an optional prefix component which is placed inside
the border of the Field and to the left of the input. Since this label animation
would be complex to get right for this case, it is instead fixed to the top left
if there is a prefix component.

This canonical example of this today would be a phone number field which
includes a country dropdown.
Now that we have prefix support in the Field component, we can also convert the
phone number with country dropdown on registration.
This converts all fields in the forgot password form to use the Field component.
As with other auth flows, this converts inputs on the login page to use the
Field component for consistent styling. The login type dropdown is left as-is
for now.
This converts the login type Dropdown on the login flow to also use the Field
component so that every presents a similar visual style.
@jryans jryans requested a review from a team March 5, 2019 18:06
res/css/views/auth/_AuthBody.scss Show resolved Hide resolved
src/components/views/elements/Field.js Outdated Show resolved Hide resolved
<Field
className={pwFieldClass}
id="mx_PasswordLogin_password"
ref={(e) => {this._passwordField = e;}}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tbh I'm a little surprised the linter isn't screaming about this.

also TIL that this is the recommended way to do refs now.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, several things to say here...

  • I happen to just be moving existing refs code here, as I didn't want to change that much since it's not directly related (other auth modules still use older strings refs, for example). (I was worried you'd be sad I was mixing too much in one PR if I also clean up those sorts of code style things!)
  • Is it the spacing that you'd expect linting errors for?
  • Since string refs are deprecated, we may want to enable the react/no-string-refs linting rule and clean then up

@jryans jryans merged commit 8bf5e1d into matrix-org:develop Mar 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants