feat(LoginPage): added headerUtilities prop for language selector example#7793
feat(LoginPage): added headerUtilities prop for language selector example#7793tlabaj merged 5 commits intopatternfly:mainfrom
Conversation
|
Preview: https://patternfly-react-pr-7793.surge.sh A11y report: https://patternfly-react-pr-7793-a11y.surge.sh |
mcarrano
left a comment
There was a problem hiding this comment.
This looks good @andyyvo . But just one request. For a language selector, it's standard practice to show language names in their native language and character set, i.e., Espanol rather than Spanish, and Asian languages in their native font. It there an easy way to do this? I believe we had a code example in PatternFly 3 that implemented this menu.
mcoker
left a comment
There was a problem hiding this comment.
Looks awesome!! Just a few nits/questions - the only thing I think really needs updating is the initially selected language ("English" in the demo) being the selected item in the menu, too. Linked to another demo that shows how that might be wired up.
| title?: string; | ||
| /** Subtitle that contains the Text, URL, and URL Text for the Login Main Header */ | ||
| subtitle?: string; | ||
| /** Select menu that renders next to the Login Title for the Login Main Header */ |
There was a problem hiding this comment.
nit - FWIW this could contain anything (likely actions of some sort), and it isn't always by the title, it's below the subtitle on small screens. I wonder if we could just describe this as a place for actions, such as a language selector, or something like that?
| @@ -12,13 +12,16 @@ export interface LoginMainHeaderProps extends React.HTMLProps<HTMLDivElement> { | |||
| title?: string; | |||
| /** Subtitle that contains the Text, URL, and URL Text for the Login Main Header */ | |||
There was a problem hiding this comment.
out of scope but what does URL and URL Text refer to? This is a generic "description" element in core, and rendered as a <p>. Seems like it might be worth updating this prop to description (like the modal component) since subtitle implies it might be a heading element or something - it would be invalid invalid to pass a heading there currently since you can't put a heading in a <p>. On that, we might also consider just making this a <div> in both core and react. If that seems valid, I can open an issue.
There was a problem hiding this comment.
I see what you mean. I could definitely see the user placing a hyperlink URL here. If you do open up that issue, feel free to tag me so I can make a react issue to update the prop name and usage
| loginTitle: string; | ||
| /** Subtitle for the Login Main Body Header of the LoginPage */ | ||
| loginSubtitle?: string; | ||
| /** Header utilities for the Login Main Body Header of the LoginPage */ |
There was a problem hiding this comment.
nit - we might consider updating these descriptions to use sentence case?
There was a problem hiding this comment.
should I update this for all of the descriptions?
There was a problem hiding this comment.
yes - even our component names are lower cased when used in a sentence
| const [selectedHeaderUtils, setSelectedHeaderUtils] = React.useState<string | SelectOption>(); | ||
|
|
||
| const headerUtilsOptions = [ | ||
| <SelectOption key={0} value="English" />, |
There was a problem hiding this comment.
Can this be selected in the menu, too? FWIW I found this filterable table demo that has "status" as initially selected, and if you open the menu, it's selected in the menu, too.
thatblindgeye
left a comment
There was a problem hiding this comment.
This is looking good so far! In addition to what has been commented already, I had some suggested changes/comments below.
|
per @thatblindgeye also removed backgroundImgAlt on the other examples |
There was a problem hiding this comment.
@mcoker @mcarrano since the header utilities is technically a container for any action, I wonder if we want to specifically name the example "With language selector". A more generic name may be appropriate. Maybe we could add a description above the example to mention the header utilities should be used to add a language selector .
|
@tlabaj sounds good to me. The language selector could also be a demo. Seems like the show/hide password is maybe a demo, too? |
|
After a convo with Andy yesterday and looking into things a bit, the I can open a separate issue (and mark it as a breaking change if necessary), but two possible options are:
|
| ```ts file='./LoginPageShowHidePassword.tsx' isFullscreen | ||
| ``` | ||
|
|
||
| ### With language selector |
There was a problem hiding this comment.
I would still suggest renaming this example and adding a description about how actions can be used for a language selector.
cc @mcarrano
There was a problem hiding this comment.
I'm OK with that if it would clarify what this example is illustrating.
@thatblindgeye I think you can open a breaking change follow up issue to remove the backgroundImgAlt |
thatblindgeye
left a comment
There was a problem hiding this comment.
Other than comments above, looks good! Will open a follow up issue based on the above as well.
|
@thatblindgeye I do not know which would be the better solution. Maybe open the breaking and pretty much copy the comment you have above and list both options. When we are implementing solution we can discus further. Or maybe get @jessiehuff's opinion in he issue. |
| loginSubtitle?: string; | ||
| /** Content rendered inside of Login Main Footer Band to display a sign up for account message */ | ||
| /** Header utilities for the login main body header of the login page */ | ||
| headerUtilities?: React.ReactNode; |
There was a problem hiding this comment.
could we label this one beta? Then we can merge.
There was a problem hiding this comment.
@tlabaj how do I label something as beta?
There was a problem hiding this comment.
Hi @andyyvo You just need to but the @beta at the beginning of the prop description. This give us the flexibility to improve on API (including breaking change) if need be. Once we decide feature is stable, we promote it out of beta and remove the tag.
/** @beta Header utilities for the login main body header of the login page */
There was a problem hiding this comment.
@tlabaj would you also like to see this on the LoginMainHeader.tsx prop as well?
What: Closes #7228 .
How: Added a
headerUtilitiesprop inLoginMainHeader.tsxusing the styling properties discussed by @mcoker and @mcarrano. UpdatedLoginPage.tsxwith aloginHeaderUtilsprop. Created an example (LoginPageLanguageSelect.tsx) to demonstrate the newSelectcomponent. This example does not change the language of the login page at the moment.Additional issues: N/A.