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
feat(LoginPage): add LoginPage component with storybook and tests. #362
Conversation
586d1e2
to
12786d6
Compare
12786d6
to
fce0190
Compare
Theoretically, if we mimic the HTML from http://www.patternfly.org/pattern-library/application-framework/login-page/#code#login-layout-markup we shouldn't need additional less/sass. |
fce0190
to
57bd2df
Compare
57bd2df
to
c1d35a4
Compare
c1d35a4
to
81f05ed
Compare
@jeff-phillips-18 I added some styles to make the page less "jumpy" when the page change dynamically. |
@LaViro This is looking super great. I'm excited to use this in my product :) I just did a quick review from a UX point of view (FYI @serenamarie125 @jgiardino) and noticed a few small things that I think would be great to update as you continue working on this.
Great work on this! I hope this feedback helps. Liz |
@lizsurette Thanks for the feedback :)
I guess you will see my updates soon, I would be happy to know what you think about the input's errors. Thanks, Ron |
8afeeb6
to
e23dbfe
Compare
11f1524
to
b0d8d9e
Compare
@LaViro Your updates all look great. I totally get what you are saying about the shifting of the form when you have to add in error messages. I think this is something that should be decided at the PF Core level before just making a change in PF-react, but it might be nice to hear from others who are closer to the process. @mcarrano @LHinson @jgiardino - If there are potential improvements to Core identified while doing work in a framework repo, what is the typical process for discussing these ideas? Maybe a topic for the coordinating across repos discussion? This specific one is around the best way to allow space for potential form errors and I don't think would just apply to the Login page, but that's the current context. Thanks, |
b0d8d9e
to
8853a88
Compare
@lizsurette and @LaViro Thanks for raising this issue. I do see what you mean, and it's difficult to evaluate this type of behavior with the core examples where the validation code is not included. @lizsurette would you mind entering an issue against patternfly-design for this? That will ensure this gets on the agenda for our weekly design meeting. I think it raises a general question about field spacing on forms and whether it is better to keep the spacing compact and let the spacing change to insert the error message or whether spacing should always account for a single row of text below the field. Sounds like you guys are recommending the later? |
@mcarrano The validation code DO exist in the managed social and basic LoginPage. Cases when error / warning will be shown:
As for the input fields, I believe that fading an error on a fixed height space will be better. Thanks :) |
@gregsheremeta @lizsurette I have added the |
Hi @LaViro, thanks again for contributing this! You've done a great job implementing one of our more complex components! And you've added a lot of nice touches. 👌
When I look at the basic login page using dev tools, I see that there's a background image defined as an inline style: But if I disable that style, it looks like there's also a background image defined for
My understanding from past discussions about this is that the implementation as it is now works as expected. I would love to see forms handle error messages in a more graceful way, but I think implementing that type of feature in a one-size-fits-all way that accommodates translation and the possibility of multiple error cases per field is not an easy thing to solve.
What you have looks correct.
When you click the "More" link to show more options, there's a larger margin between the options that were visible and the options that become visible. Instead of having two separate The core html/css implementation doesn't include the divider, but the design does. I think for now, we can assume that the design is correct, and keep the divider like you have it, but there aren't styles in the core css to produce the same layout that's shown in the design. And right now, the spacing in this implementation doesn't fully match the design: My suggestion would be to add the following to the pf-react css, which will also fix the margin issue that I mention above: This will not match the design document exactly, but I think it's close enough, and we need to create a separate issue anyway to track down why there's a difference and figure out what the expected solution should be. So we can revisit this layout later if needed when that issue is resolved. Also in this implementation, I see that you animate the transition when clicking the Less/More link, which is a really nice touch. But it seems to stick when expanding. It shows the first 3, pauses, then expands all the way to show the 4th one. Do you see that in your build? Is there anyway to adjust that animation?
I can't find an example of this in core. I'd say it's fine as it is for now, and we can revisit this element in core and update later as needed. One other thing I noticed - |
Wow @jgiardino, thanks for the detailed review !
It gives a way for the developers to insert a background from props without dealing with css:
I think pf should remove this image from the
I see three options:
and maybe add a class to PF that do collapse ? providing gifs of the options: the regular also solves the css problem with the margin between sections:
I was writing about this issue here above, it works fine for me, I saw that there are problems with CapsLock detection on Mac and some browsers, |
Thanks for the clarification about the background image. That makes a lot of sense! 😉 I opened an issue in patternfly core to capture this question, plus a couple of others that came up during review: patternfly/patternfly#1125 I was just chatting with @mcarrano about the issues with the responsive state (i.e. the issue with the extra margin and the issue with the animation not being a smooth transition from start to finish when clicking More). @mcarrano's recommendation for resolving this is to remove the More/Less toggle from the responsive state, since there isn't much benefit to the user in collapsing the extra options on a mobile device. Is it possible to remove the toggle from the responsive state and keep it for the other? @mcarrano's feedback was that if it's problematic to do this, then his recommendation is to remove the toggle altogether.
If you are having difficulty reproducing this issue and finding a solution for it, we can capture this in a follow-up issue for someone with a mac to look into. |
hey @LaViro This is looking great! Thanks for putting in all the effort here. I'm going to do the final CSS review so we can get this moving while Jenn is away on PTO next week. |
@matthewcarleton @jgiardino @jeff-phillips-18 I think I've fixed the |
…ix language dropdown classes, Refactor social-columns.
19a2d2c
to
fe1f495
Compare
Hey @LaViro, great work, thanks! and that should resolve the margin issue. The line for mobile should not be in the design and the design will be updated to reflect this :) What are your thoughts on removing the more/less toggle? Is this difficult to do? I like @mcarrano's suggestion of removing it altogether too if that more reasonable from a technical stand point. I think if we address those two things we can move forward with this. |
This is looking really nice to me @LaViro ! I will add a couple of comments inline, but overall very happy w/ this. One thing you will definitely want to do before merging is export your Login components in the main patternfly-react barrel file ( |
@@ -0,0 +1,27 @@ | |||
import dropbox from './dropbox-logo.svg'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we do not need to duplicate these logos here in patternfly-react. They can be consumed/re-exported directly from Patternfly since we are directly dependent on PF.
That being said, I think we can change this to :
import dropbox from 'patternfly/dist/img/dropbox-logo.svg';
import facebook from 'patternfly/dist/img/facebook-logo.svg';
import fedora from 'patternfly/dist/img/fedora-logo.png';
import git from 'patternfly/dist/img/git-logo.svg';
import github from 'patternfly/dist/img/github-logo.svg';
import google from 'patternfly/dist/img/google-logo.svg';
import instagram from 'patternfly/dist/img/instagram-logo.png';
import linkedin from 'patternfly/dist/img/linkedin-logo.svg';
import openID from 'patternfly/dist/img/open-id-logo.svg';
import skype from 'patternfly/dist/img/skype-logo.svg';
import stackExchange from 'patternfly/dist/img/stack-exchange-logo.svg';
import twitter from 'patternfly/dist/img/twitter-logo.svg';
and delete all of the new logo assets coming from PF...
if (!this.state.passwordField.value) { | ||
return; | ||
} | ||
e.key === 'CapsLock' && |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We started tracking all keycodes for accessibility in src/helpers.js
, KEY_CODES
constant. I think it is best to have one constant for these.
const keyCode = e.keyCode ? e.keyCode : e.which; | ||
const shiftKey = e.shiftKey ? e.shiftKey : keyCode === 16; | ||
const isCapsLock = | ||
(keyCode >= 65 && keyCode <= 90 && !shiftKey) || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(same as above)
@@ -0,0 +1,87 @@ | |||
import React from 'react'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Definitely a higher order component (pattern). The LoginPageWithTranslation
and LoginCardWithValidation
components seem to do a lot of internal state management. I think I would generally handle that in the application, but since you have done such a nice job breaking down the components, this should not be an issue (and will probably help a lot of consumers needing less fine grain detail). I'm OK proceeding here if others are ;-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you so much @priley !
The consumer of this component can decided whether they
want the component with validation or not,
by setting the form: { validate }
prop.
thanks @matthewcarleton, |
awesome! @jeff-phillips-18 this is good to go from a CSS perspective. |
@LaViro, @LHinson, from talking with @priley86, we have two necessary changes: Please add a comment and tag @priley86 and I once those two changes have been made and this is ready to go in. |
…them from patternfly instead, Rename ForgotPassword, InputWarning and RememberMe
Filed #530 for any follow-up enhancements. This looks good to go from my standpoint! |
affects: patternfly-react
Add LoginPage component with storybook and tests. fix #80
Pattern
Storybook
Basic Login Page:
Social Login Page