@patternfly/react-core 4.224.8 → 4.224.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +24 -0
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts +2 -0
- package/dist/esm/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelector.js +8 -11
- package/dist/esm/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelectorMenuList.d.ts.map +1 -1
- package/dist/esm/components/ContextSelector/ContextSelectorMenuList.js +2 -1
- package/dist/esm/components/ContextSelector/ContextSelectorMenuList.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelector.js +6 -6
- package/dist/esm/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorControlsWrapper.js +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorControlsWrapper.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorList.d.ts +1 -0
- package/dist/esm/components/DualListSelector/DualListSelectorList.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorList.js +7 -1
- package/dist/esm/components/DualListSelector/DualListSelectorList.js.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTree.d.ts +3 -2
- package/dist/esm/components/DualListSelector/DualListSelectorTree.d.ts.map +1 -1
- package/dist/esm/components/DualListSelector/DualListSelectorTree.js.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.d.ts +7 -0
- package/dist/esm/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/esm/components/SearchInput/SearchInput.js +9 -4
- package/dist/esm/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.d.ts +2 -0
- package/dist/js/components/ContextSelector/ContextSelector.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelector.js +7 -10
- package/dist/js/components/ContextSelector/ContextSelector.js.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelectorMenuList.d.ts.map +1 -1
- package/dist/js/components/ContextSelector/ContextSelectorMenuList.js +2 -1
- package/dist/js/components/ContextSelector/ContextSelectorMenuList.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelector.js +5 -5
- package/dist/js/components/DualListSelector/DualListSelector.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorControlsWrapper.js +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorControlsWrapper.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorList.d.ts +1 -0
- package/dist/js/components/DualListSelector/DualListSelectorList.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorList.js +7 -1
- package/dist/js/components/DualListSelector/DualListSelectorList.js.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorTree.d.ts +3 -2
- package/dist/js/components/DualListSelector/DualListSelectorTree.d.ts.map +1 -1
- package/dist/js/components/DualListSelector/DualListSelectorTree.js.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.d.ts +7 -0
- package/dist/js/components/SearchInput/SearchInput.d.ts.map +1 -1
- package/dist/js/components/SearchInput/SearchInput.js +9 -4
- package/dist/js/components/SearchInput/SearchInput.js.map +1 -1
- package/dist/styles/base-no-reset.css +10 -10
- package/dist/styles/base.css +10 -10
- package/dist/umd/react-core.css +797 -967
- package/dist/umd/react-core.js +709 -726
- package/dist/umd/react-core.min.css +39 -209
- package/dist/umd/react-core.min.js +4 -4
- package/package.json +7 -7
- package/src/components/Accordion/examples/AccordionBordered.tsx +21 -21
- package/src/components/Accordion/examples/AccordionDefinitionList.tsx +21 -21
- package/src/components/ActionList/__tests__/ActionList.test.tsx +46 -11
- package/src/components/ActionList/__tests__/ActionListGroup.test.tsx +34 -7
- package/src/components/ActionList/__tests__/ActionListItem.test.tsx +34 -7
- package/src/components/ActionList/__tests__/__snapshots__/ActionList.test.tsx.snap +1 -11
- package/src/components/ActionList/__tests__/__snapshots__/ActionListGroup.test.tsx.snap +1 -1
- package/src/components/ActionList/__tests__/__snapshots__/ActionListItem.test.tsx.snap +1 -1
- package/src/components/ActionList/examples/ActionListMultipleGroups.tsx +4 -4
- package/src/components/ActionList/examples/ActionListSingleGroup.tsx +4 -4
- package/src/components/ActionList/examples/ActionListWithCancelButton.tsx +5 -5
- package/src/components/ActionList/examples/ActionListWithIcons.tsx +2 -2
- package/src/components/Card/examples/CardSelectableA11yHighlight.tsx +4 -4
- package/src/components/CodeBlock/examples/CodeBlockBasic.tsx +1 -1
- package/src/components/CodeBlock/examples/CodeBlockExpandable.tsx +1 -1
- package/src/components/ContextSelector/ContextSelector.tsx +11 -10
- package/src/components/ContextSelector/ContextSelectorMenuList.tsx +2 -1
- package/src/components/ContextSelector/__tests__/ContextSelector.test.tsx +2 -2
- package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelector.test.tsx.snap +11 -7
- package/src/components/ContextSelector/__tests__/__snapshots__/ContextSelectorMenuList.test.tsx.snap +10 -0
- package/src/components/DataList/examples/DataListCompact.tsx +4 -4
- package/src/components/DataList/examples/DataListControllingText.tsx +3 -3
- package/src/components/DataList/examples/DataListDraggable.tsx +14 -7
- package/src/components/DataList/examples/DataListExpandable.tsx +3 -3
- package/src/components/DataList/examples/DataListSmGridBreakpoint.tsx +3 -3
- package/src/components/DualListSelector/DualListSelector.tsx +93 -89
- package/src/components/DualListSelector/DualListSelectorControlsWrapper.tsx +1 -1
- package/src/components/DualListSelector/DualListSelectorList.tsx +10 -4
- package/src/components/DualListSelector/DualListSelectorTree.tsx +3 -2
- package/src/components/DualListSelector/__tests__/__snapshots__/DualListSelector.test.tsx.snap +6 -20
- package/src/components/DualListSelector/examples/DualListSelector.md +3 -1
- package/src/components/DualListSelector/examples/DualListSelectorComposable.tsx +1 -1
- package/src/components/DualListSelector/examples/DualListSelectorComposableDragDrop.tsx +1 -1
- package/src/components/DualListSelector/examples/DualListSelectorComposableTree.tsx +1 -1
- package/src/components/DualListSelector/examples/{DualListSelectorTree.tsx → DualListSelectorTreeExample.tsx} +1 -1
- package/src/components/FileUpload/examples/FileUploadCustomUpload.tsx +1 -1
- package/src/components/FileUpload/examples/FileUploadSimpleText.tsx +1 -1
- package/src/components/FileUpload/examples/FileUploadTextWithEdits.tsx +1 -1
- package/src/components/FileUpload/examples/FileUploadTextWithRestrictions.tsx +2 -2
- package/src/components/InputGroup/examples/InputGroupBasic.tsx +3 -3
- package/src/components/InputGroup/examples/InputGroupWithDropdown.tsx +1 -1
- package/src/components/InputGroup/examples/InputGroupWithPopover.tsx +12 -2
- package/src/components/InputGroup/examples/InputGroupWithSiblings.tsx +7 -2
- package/src/components/InputGroup/examples/InputGroupWithTextarea.tsx +1 -1
- package/src/components/LoginPage/examples/LoginPage.md +2 -325
- package/src/components/LoginPage/examples/LoginPageBasic.tsx +144 -0
- package/src/components/LoginPage/examples/LoginPageShowHidePassword.tsx +145 -0
- package/src/components/NotificationDrawer/examples/NotificationDrawer.md +69 -68
- package/src/components/SearchInput/SearchInput.tsx +32 -5
- package/src/components/SearchInput/__tests__/SearchInput.test.tsx +37 -0
- package/src/components/SearchInput/__tests__/__snapshots__/SearchInput.test.tsx.snap +193 -4
|
@@ -19,336 +19,13 @@ propComponents:
|
|
|
19
19
|
---
|
|
20
20
|
|
|
21
21
|
import brandImg2 from './brandImgColor2.svg';
|
|
22
|
-
import {
|
|
23
|
-
LoginFooterItem,
|
|
24
|
-
LoginForm,
|
|
25
|
-
LoginMainFooterBandItem,
|
|
26
|
-
LoginMainFooterLinksItem,
|
|
27
|
-
LoginPage,
|
|
28
|
-
ListItem
|
|
29
|
-
} from '@patternfly/react-core';
|
|
30
22
|
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
31
23
|
|
|
32
24
|
## Examples
|
|
33
25
|
### Basic
|
|
34
|
-
```
|
|
35
|
-
import React from 'react';
|
|
36
|
-
import brandImg from './brandImgColor.svg';
|
|
37
|
-
import {
|
|
38
|
-
LoginFooterItem,
|
|
39
|
-
LoginForm,
|
|
40
|
-
LoginMainFooterBandItem,
|
|
41
|
-
LoginMainFooterLinksItem,
|
|
42
|
-
LoginPage,
|
|
43
|
-
BackgroundImageSrc,
|
|
44
|
-
ListItem
|
|
45
|
-
} from '@patternfly/react-core';
|
|
46
|
-
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
47
|
-
|
|
48
|
-
class SimpleLoginPage extends React.Component {
|
|
49
|
-
constructor(props) {
|
|
50
|
-
super(props);
|
|
51
|
-
this.state = {
|
|
52
|
-
showHelperText: false,
|
|
53
|
-
usernameValue: '',
|
|
54
|
-
isValidUsername: true,
|
|
55
|
-
passwordValue: '',
|
|
56
|
-
isValidPassword: true,
|
|
57
|
-
isRememberMeChecked: false
|
|
58
|
-
};
|
|
59
|
-
|
|
60
|
-
this.handleUsernameChange = value => {
|
|
61
|
-
this.setState({ usernameValue: value });
|
|
62
|
-
};
|
|
63
|
-
|
|
64
|
-
this.handlePasswordChange = passwordValue => {
|
|
65
|
-
this.setState({ passwordValue });
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
this.onRememberMeClick = () => {
|
|
69
|
-
this.setState({ isRememberMeChecked: !this.state.isRememberMeChecked });
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
this.onLoginButtonClick = event => {
|
|
73
|
-
event.preventDefault();
|
|
74
|
-
this.setState({ isValidUsername: !!this.state.usernameValue });
|
|
75
|
-
this.setState({ isValidPassword: !!this.state.passwordValue });
|
|
76
|
-
this.setState({ showHelperText: !this.state.usernameValue || !this.state.passwordValue });
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
render() {
|
|
81
|
-
const helperText = (
|
|
82
|
-
<React.Fragment>
|
|
83
|
-
<ExclamationCircleIcon />
|
|
84
|
-
Invalid login credentials.
|
|
85
|
-
</React.Fragment>
|
|
86
|
-
);
|
|
87
|
-
|
|
88
|
-
const socialMediaLoginContent = (
|
|
89
|
-
<React.Fragment>
|
|
90
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Google' }}>
|
|
91
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512">
|
|
92
|
-
<path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
|
|
93
|
-
</svg>
|
|
94
|
-
</LoginMainFooterLinksItem>
|
|
95
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Github' }}>
|
|
96
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
|
|
97
|
-
<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" />
|
|
98
|
-
</svg>
|
|
99
|
-
</LoginMainFooterLinksItem>
|
|
100
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Dropbox' }}>
|
|
101
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 528 512">
|
|
102
|
-
<path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z" />
|
|
103
|
-
</svg>
|
|
104
|
-
</LoginMainFooterLinksItem>
|
|
105
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Facebook' }}>
|
|
106
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
107
|
-
<path d="M448 56.7v398.5c0 13.7-11.1 24.7-24.7 24.7H309.1V306.5h58.2l8.7-67.6h-67v-43.2c0-19.6 5.4-32.9 33.5-32.9h35.8v-60.5c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9h-58.4v67.6h58.4V480H24.7C11.1 480 0 468.9 0 455.3V56.7C0 43.1 11.1 32 24.7 32h398.5c13.7 0 24.8 11.1 24.8 24.7z" />
|
|
108
|
-
</svg>
|
|
109
|
-
</LoginMainFooterLinksItem>
|
|
110
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Gitlab' }}>
|
|
111
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
112
|
-
<path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z" />
|
|
113
|
-
</svg>
|
|
114
|
-
</LoginMainFooterLinksItem>
|
|
115
|
-
</React.Fragment>
|
|
116
|
-
);
|
|
117
|
-
|
|
118
|
-
const signUpForAccountMessage = (
|
|
119
|
-
<LoginMainFooterBandItem>
|
|
120
|
-
Need an account? <a href="#">Sign up.</a>
|
|
121
|
-
</LoginMainFooterBandItem>
|
|
122
|
-
);
|
|
123
|
-
const forgotCredentials = (
|
|
124
|
-
<LoginMainFooterBandItem>
|
|
125
|
-
<a href="#">Forgot username or password?</a>
|
|
126
|
-
</LoginMainFooterBandItem>
|
|
127
|
-
);
|
|
128
|
-
|
|
129
|
-
const listItem = (
|
|
130
|
-
<React.Fragment>
|
|
131
|
-
<ListItem>
|
|
132
|
-
<LoginFooterItem href="#">Terms of Use </LoginFooterItem>
|
|
133
|
-
</ListItem>
|
|
134
|
-
<ListItem>
|
|
135
|
-
<LoginFooterItem href="#">Help</LoginFooterItem>
|
|
136
|
-
</ListItem>
|
|
137
|
-
<ListItem>
|
|
138
|
-
<LoginFooterItem href="#">Privacy Policy</LoginFooterItem>
|
|
139
|
-
</ListItem>
|
|
140
|
-
</React.Fragment>
|
|
141
|
-
);
|
|
142
|
-
|
|
143
|
-
const loginForm = (
|
|
144
|
-
<LoginForm
|
|
145
|
-
showHelperText={this.state.showHelperText}
|
|
146
|
-
helperText={helperText}
|
|
147
|
-
helperTextIcon={<ExclamationCircleIcon />}
|
|
148
|
-
usernameLabel="Username"
|
|
149
|
-
usernameValue={this.state.usernameValue}
|
|
150
|
-
onChangeUsername={this.handleUsernameChange}
|
|
151
|
-
isValidUsername={this.state.isValidUsername}
|
|
152
|
-
passwordLabel="Password"
|
|
153
|
-
passwordValue={this.state.passwordValue}
|
|
154
|
-
onChangePassword={this.handlePasswordChange}
|
|
155
|
-
isValidPassword={this.state.isValidPassword}
|
|
156
|
-
rememberMeLabel="Keep me logged in for 30 days."
|
|
157
|
-
isRememberMeChecked={this.state.isRememberMeChecked}
|
|
158
|
-
onChangeRememberMe={this.onRememberMeClick}
|
|
159
|
-
onLoginButtonClick={this.onLoginButtonClick}
|
|
160
|
-
loginButtonLabel="Log in"
|
|
161
|
-
/>
|
|
162
|
-
);
|
|
163
|
-
|
|
164
|
-
const images = {
|
|
165
|
-
lg: '/assets/images/pfbg_1200.jpg',
|
|
166
|
-
sm: '/assets/images/pfbg_768.jpg',
|
|
167
|
-
sm2x: '/assets/images/pfbg_768@2x.jpg',
|
|
168
|
-
xs: '/assets/images/pfbg_576.jpg',
|
|
169
|
-
xs2x: '/assets/images/pfbg_576@2x.jpg'
|
|
170
|
-
};
|
|
171
|
-
|
|
172
|
-
return (
|
|
173
|
-
<LoginPage
|
|
174
|
-
footerListVariants="inline"
|
|
175
|
-
brandImgSrc={brandImg2}
|
|
176
|
-
brandImgAlt="PatternFly logo"
|
|
177
|
-
backgroundImgSrc={images}
|
|
178
|
-
backgroundImgAlt="Images"
|
|
179
|
-
footerListItems={listItem}
|
|
180
|
-
textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
|
|
181
|
-
loginTitle="Log in to your account"
|
|
182
|
-
loginSubtitle="Enter your single sign-on LDAP credentials."
|
|
183
|
-
socialMediaLoginContent={socialMediaLoginContent}
|
|
184
|
-
signUpForAccountMessage={signUpForAccountMessage}
|
|
185
|
-
forgotCredentials={forgotCredentials}
|
|
186
|
-
>
|
|
187
|
-
{loginForm}
|
|
188
|
-
</LoginPage>
|
|
189
|
-
);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
26
|
+
```ts file='./LoginPageBasic.tsx' isFullscreen
|
|
192
27
|
```
|
|
193
28
|
|
|
194
29
|
### Show/hide password
|
|
195
|
-
```
|
|
196
|
-
import React from 'react';
|
|
197
|
-
import brandImg from './brandImgColor.svg';
|
|
198
|
-
import {
|
|
199
|
-
LoginFooterItem,
|
|
200
|
-
LoginForm,
|
|
201
|
-
LoginMainFooterBandItem,
|
|
202
|
-
LoginMainFooterLinksItem,
|
|
203
|
-
LoginPage,
|
|
204
|
-
BackgroundImageSrc,
|
|
205
|
-
ListItem
|
|
206
|
-
} from '@patternfly/react-core';
|
|
207
|
-
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
208
|
-
|
|
209
|
-
class HideShowPasswordPage extends React.Component {
|
|
210
|
-
constructor(props) {
|
|
211
|
-
super(props);
|
|
212
|
-
this.state = {
|
|
213
|
-
showHelperText: false,
|
|
214
|
-
usernameValue: '',
|
|
215
|
-
isValidUsername: true,
|
|
216
|
-
passwordValue: '',
|
|
217
|
-
isValidPassword: true,
|
|
218
|
-
isRememberMeChecked: false
|
|
219
|
-
};
|
|
220
|
-
|
|
221
|
-
this.handleUsernameChange = value => {
|
|
222
|
-
this.setState({ usernameValue: value });
|
|
223
|
-
};
|
|
224
|
-
|
|
225
|
-
this.handlePasswordChange = passwordValue => {
|
|
226
|
-
this.setState({ passwordValue });
|
|
227
|
-
};
|
|
228
|
-
|
|
229
|
-
this.onRememberMeClick = () => {
|
|
230
|
-
this.setState({ isRememberMeChecked: !this.state.isRememberMeChecked });
|
|
231
|
-
};
|
|
232
|
-
|
|
233
|
-
this.onLoginButtonClick = event => {
|
|
234
|
-
event.preventDefault();
|
|
235
|
-
this.setState({ isValidUsername: !!this.state.usernameValue });
|
|
236
|
-
this.setState({ isValidPassword: !!this.state.passwordValue });
|
|
237
|
-
this.setState({ showHelperText: !this.state.usernameValue || !this.state.passwordValue });
|
|
238
|
-
};
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
render() {
|
|
242
|
-
const helperText = (
|
|
243
|
-
<React.Fragment>
|
|
244
|
-
<ExclamationCircleIcon />
|
|
245
|
-
Invalid login credentials.
|
|
246
|
-
</React.Fragment>
|
|
247
|
-
);
|
|
248
|
-
|
|
249
|
-
const socialMediaLoginContent = (
|
|
250
|
-
<React.Fragment>
|
|
251
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Google' }}>
|
|
252
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512">
|
|
253
|
-
<path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
|
|
254
|
-
</svg>
|
|
255
|
-
</LoginMainFooterLinksItem>
|
|
256
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Github' }}>
|
|
257
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
|
|
258
|
-
<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" />
|
|
259
|
-
</svg>
|
|
260
|
-
</LoginMainFooterLinksItem>
|
|
261
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Dropbox' }}>
|
|
262
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 528 512">
|
|
263
|
-
<path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z" />
|
|
264
|
-
</svg>
|
|
265
|
-
</LoginMainFooterLinksItem>
|
|
266
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Facebook' }}>
|
|
267
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
268
|
-
<path d="M448 56.7v398.5c0 13.7-11.1 24.7-24.7 24.7H309.1V306.5h58.2l8.7-67.6h-67v-43.2c0-19.6 5.4-32.9 33.5-32.9h35.8v-60.5c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9h-58.4v67.6h58.4V480H24.7C11.1 480 0 468.9 0 455.3V56.7C0 43.1 11.1 32 24.7 32h398.5c13.7 0 24.8 11.1 24.8 24.7z" />
|
|
269
|
-
</svg>
|
|
270
|
-
</LoginMainFooterLinksItem>
|
|
271
|
-
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Gitlab' }}>
|
|
272
|
-
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
273
|
-
<path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z" />
|
|
274
|
-
</svg>
|
|
275
|
-
</LoginMainFooterLinksItem>
|
|
276
|
-
</React.Fragment>
|
|
277
|
-
);
|
|
278
|
-
|
|
279
|
-
const signUpForAccountMessage = (
|
|
280
|
-
<LoginMainFooterBandItem>
|
|
281
|
-
Need an account? <a href="#">Sign up.</a>
|
|
282
|
-
</LoginMainFooterBandItem>
|
|
283
|
-
);
|
|
284
|
-
const forgotCredentials = (
|
|
285
|
-
<LoginMainFooterBandItem>
|
|
286
|
-
<a href="#">Forgot username or password?</a>
|
|
287
|
-
</LoginMainFooterBandItem>
|
|
288
|
-
);
|
|
289
|
-
|
|
290
|
-
const listItem = (
|
|
291
|
-
<React.Fragment>
|
|
292
|
-
<ListItem>
|
|
293
|
-
<LoginFooterItem href="#">Terms of Use </LoginFooterItem>
|
|
294
|
-
</ListItem>
|
|
295
|
-
<ListItem>
|
|
296
|
-
<LoginFooterItem href="#">Help</LoginFooterItem>
|
|
297
|
-
</ListItem>
|
|
298
|
-
<ListItem>
|
|
299
|
-
<LoginFooterItem href="#">Privacy Policy</LoginFooterItem>
|
|
300
|
-
</ListItem>
|
|
301
|
-
</React.Fragment>
|
|
302
|
-
);
|
|
303
|
-
|
|
304
|
-
const loginForm = (
|
|
305
|
-
<LoginForm
|
|
306
|
-
showHelperText={this.state.showHelperText}
|
|
307
|
-
helperText={helperText}
|
|
308
|
-
helperTextIcon={<ExclamationCircleIcon />}
|
|
309
|
-
usernameLabel="Username"
|
|
310
|
-
usernameValue={this.state.usernameValue}
|
|
311
|
-
onChangeUsername={this.handleUsernameChange}
|
|
312
|
-
isValidUsername={this.state.isValidUsername}
|
|
313
|
-
passwordLabel="Password"
|
|
314
|
-
passwordValue={this.state.passwordValue}
|
|
315
|
-
isShowPasswordEnabled
|
|
316
|
-
onChangePassword={this.handlePasswordChange}
|
|
317
|
-
isValidPassword={this.state.isValidPassword}
|
|
318
|
-
rememberMeLabel="Keep me logged in for 30 days."
|
|
319
|
-
isRememberMeChecked={this.state.isRememberMeChecked}
|
|
320
|
-
onChangeRememberMe={this.onRememberMeClick}
|
|
321
|
-
onLoginButtonClick={this.onLoginButtonClick}
|
|
322
|
-
loginButtonLabel="Log in"
|
|
323
|
-
/>
|
|
324
|
-
);
|
|
325
|
-
|
|
326
|
-
const images = {
|
|
327
|
-
lg: '/assets/images/pfbg_1200.jpg',
|
|
328
|
-
sm: '/assets/images/pfbg_768.jpg',
|
|
329
|
-
sm2x: '/assets/images/pfbg_768@2x.jpg',
|
|
330
|
-
xs: '/assets/images/pfbg_576.jpg',
|
|
331
|
-
xs2x: '/assets/images/pfbg_576@2x.jpg'
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
return (
|
|
335
|
-
<LoginPage
|
|
336
|
-
footerListVariants="inline"
|
|
337
|
-
brandImgSrc={brandImg2}
|
|
338
|
-
brandImgAlt="PatternFly logo"
|
|
339
|
-
backgroundImgSrc={images}
|
|
340
|
-
backgroundImgAlt="Images"
|
|
341
|
-
footerListItems={listItem}
|
|
342
|
-
textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
|
|
343
|
-
loginTitle="Log in to your account"
|
|
344
|
-
loginSubtitle="Enter your single sign-on LDAP credentials."
|
|
345
|
-
socialMediaLoginContent={socialMediaLoginContent}
|
|
346
|
-
signUpForAccountMessage={signUpForAccountMessage}
|
|
347
|
-
forgotCredentials={forgotCredentials}
|
|
348
|
-
>
|
|
349
|
-
{loginForm}
|
|
350
|
-
</LoginPage>
|
|
351
|
-
);
|
|
352
|
-
}
|
|
353
|
-
}
|
|
30
|
+
```ts file='./LoginPageShowHidePassword.tsx' isFullscreen
|
|
354
31
|
```
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import brandImg2 from './brandImgColor2.svg';
|
|
3
|
+
import {
|
|
4
|
+
LoginFooterItem,
|
|
5
|
+
LoginForm,
|
|
6
|
+
LoginMainFooterBandItem,
|
|
7
|
+
LoginMainFooterLinksItem,
|
|
8
|
+
LoginPage,
|
|
9
|
+
ListItem,
|
|
10
|
+
ListVariant
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
13
|
+
|
|
14
|
+
export const SimpleLoginPage: React.FunctionComponent = () => {
|
|
15
|
+
const [showHelperText, setShowHelperText] = React.useState(false);
|
|
16
|
+
const [username, setUsername] = React.useState('');
|
|
17
|
+
const [isValidUsername, setIsValidUsername] = React.useState(true);
|
|
18
|
+
const [password, setPassword] = React.useState('');
|
|
19
|
+
const [isValidPassword, setIsValidPassword] = React.useState(true);
|
|
20
|
+
const [isRememberMeChecked, setIsRememberMeChecked] = React.useState(false);
|
|
21
|
+
|
|
22
|
+
const handleUsernameChange = (value: string) => {
|
|
23
|
+
setUsername(value);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handlePasswordChange = (value: string) => {
|
|
27
|
+
setPassword(value);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const onRememberMeClick = () => {
|
|
31
|
+
setIsRememberMeChecked(!isRememberMeChecked);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const onLoginButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
setIsValidUsername(!!username);
|
|
37
|
+
setIsValidPassword(!!password);
|
|
38
|
+
setShowHelperText(!username || !password);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const socialMediaLoginContent = (
|
|
42
|
+
<React.Fragment>
|
|
43
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Google' }}>
|
|
44
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512">
|
|
45
|
+
<path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
|
|
46
|
+
</svg>
|
|
47
|
+
</LoginMainFooterLinksItem>
|
|
48
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Github' }}>
|
|
49
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
|
|
50
|
+
<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" />
|
|
51
|
+
</svg>
|
|
52
|
+
</LoginMainFooterLinksItem>
|
|
53
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Dropbox' }}>
|
|
54
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 528 512">
|
|
55
|
+
<path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z" />
|
|
56
|
+
</svg>
|
|
57
|
+
</LoginMainFooterLinksItem>
|
|
58
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Facebook' }}>
|
|
59
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
60
|
+
<path d="M448 56.7v398.5c0 13.7-11.1 24.7-24.7 24.7H309.1V306.5h58.2l8.7-67.6h-67v-43.2c0-19.6 5.4-32.9 33.5-32.9h35.8v-60.5c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9h-58.4v67.6h58.4V480H24.7C11.1 480 0 468.9 0 455.3V56.7C0 43.1 11.1 32 24.7 32h398.5c13.7 0 24.8 11.1 24.8 24.7z" />
|
|
61
|
+
</svg>
|
|
62
|
+
</LoginMainFooterLinksItem>
|
|
63
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Gitlab' }}>
|
|
64
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
65
|
+
<path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z" />
|
|
66
|
+
</svg>
|
|
67
|
+
</LoginMainFooterLinksItem>
|
|
68
|
+
</React.Fragment>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const signUpForAccountMessage = (
|
|
72
|
+
<LoginMainFooterBandItem>
|
|
73
|
+
Need an account? <a href="#">Sign up.</a>
|
|
74
|
+
</LoginMainFooterBandItem>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const forgotCredentials = (
|
|
78
|
+
<LoginMainFooterBandItem>
|
|
79
|
+
<a href="#">Forgot username or password?</a>
|
|
80
|
+
</LoginMainFooterBandItem>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const listItem = (
|
|
84
|
+
<React.Fragment>
|
|
85
|
+
<ListItem>
|
|
86
|
+
<LoginFooterItem href="#">Terms of Use </LoginFooterItem>
|
|
87
|
+
</ListItem>
|
|
88
|
+
<ListItem>
|
|
89
|
+
<LoginFooterItem href="#">Help</LoginFooterItem>
|
|
90
|
+
</ListItem>
|
|
91
|
+
<ListItem>
|
|
92
|
+
<LoginFooterItem href="#">Privacy Policy</LoginFooterItem>
|
|
93
|
+
</ListItem>
|
|
94
|
+
</React.Fragment>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const loginForm = (
|
|
98
|
+
<LoginForm
|
|
99
|
+
showHelperText={showHelperText}
|
|
100
|
+
helperText="Invalid login credentials."
|
|
101
|
+
helperTextIcon={<ExclamationCircleIcon />}
|
|
102
|
+
usernameLabel="Username"
|
|
103
|
+
usernameValue={username}
|
|
104
|
+
onChangeUsername={handleUsernameChange}
|
|
105
|
+
isValidUsername={isValidUsername}
|
|
106
|
+
passwordLabel="Password"
|
|
107
|
+
passwordValue={password}
|
|
108
|
+
onChangePassword={handlePasswordChange}
|
|
109
|
+
isValidPassword={isValidPassword}
|
|
110
|
+
rememberMeLabel="Keep me logged in for 30 days."
|
|
111
|
+
isRememberMeChecked={isRememberMeChecked}
|
|
112
|
+
onChangeRememberMe={onRememberMeClick}
|
|
113
|
+
onLoginButtonClick={onLoginButtonClick}
|
|
114
|
+
loginButtonLabel="Log in"
|
|
115
|
+
/>
|
|
116
|
+
);
|
|
117
|
+
|
|
118
|
+
const images = {
|
|
119
|
+
lg: '/assets/images/pfbg_1200.jpg',
|
|
120
|
+
sm: '/assets/images/pfbg_768.jpg',
|
|
121
|
+
sm2x: '/assets/images/pfbg_768@2x.jpg',
|
|
122
|
+
xs: '/assets/images/pfbg_576.jpg',
|
|
123
|
+
xs2x: '/assets/images/pfbg_576@2x.jpg'
|
|
124
|
+
};
|
|
125
|
+
|
|
126
|
+
return (
|
|
127
|
+
<LoginPage
|
|
128
|
+
footerListVariants={ListVariant.inline}
|
|
129
|
+
brandImgSrc={brandImg2}
|
|
130
|
+
brandImgAlt="PatternFly logo"
|
|
131
|
+
backgroundImgSrc={images}
|
|
132
|
+
backgroundImgAlt="Images"
|
|
133
|
+
footerListItems={listItem}
|
|
134
|
+
textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
|
|
135
|
+
loginTitle="Log in to your account"
|
|
136
|
+
loginSubtitle="Enter your single sign-on LDAP credentials."
|
|
137
|
+
socialMediaLoginContent={socialMediaLoginContent}
|
|
138
|
+
signUpForAccountMessage={signUpForAccountMessage}
|
|
139
|
+
forgotCredentials={forgotCredentials}
|
|
140
|
+
>
|
|
141
|
+
{loginForm}
|
|
142
|
+
</LoginPage>
|
|
143
|
+
);
|
|
144
|
+
};
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import brandImg2 from './brandImgColor2.svg';
|
|
3
|
+
import {
|
|
4
|
+
LoginFooterItem,
|
|
5
|
+
LoginForm,
|
|
6
|
+
LoginMainFooterBandItem,
|
|
7
|
+
LoginMainFooterLinksItem,
|
|
8
|
+
LoginPage,
|
|
9
|
+
ListItem,
|
|
10
|
+
ListVariant
|
|
11
|
+
} from '@patternfly/react-core';
|
|
12
|
+
import ExclamationCircleIcon from '@patternfly/react-icons/dist/esm/icons/exclamation-circle-icon';
|
|
13
|
+
|
|
14
|
+
export const LoginPageHideShowPassword: React.FunctionComponent = () => {
|
|
15
|
+
const [showHelperText, setShowHelperText] = React.useState(false);
|
|
16
|
+
const [username, setUsername] = React.useState('');
|
|
17
|
+
const [isValidUsername, setIsValidUsername] = React.useState(true);
|
|
18
|
+
const [password, setPassword] = React.useState('');
|
|
19
|
+
const [isValidPassword, setIsValidPassword] = React.useState(true);
|
|
20
|
+
const [isRememberMeChecked, setIsRememberMeChecked] = React.useState(false);
|
|
21
|
+
|
|
22
|
+
const handleUsernameChange = (value: string) => {
|
|
23
|
+
setUsername(value);
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
const handlePasswordChange = (value: string) => {
|
|
27
|
+
setPassword(value);
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const onRememberMeClick = () => {
|
|
31
|
+
setIsRememberMeChecked(!isRememberMeChecked);
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const onLoginButtonClick = (event: React.MouseEvent<HTMLButtonElement, MouseEvent>) => {
|
|
35
|
+
event.preventDefault();
|
|
36
|
+
setIsValidUsername(!!username);
|
|
37
|
+
setIsValidPassword(!!password);
|
|
38
|
+
setShowHelperText(!username || !password);
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
const socialMediaLoginContent = (
|
|
42
|
+
<React.Fragment>
|
|
43
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Google' }}>
|
|
44
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 488 512">
|
|
45
|
+
<path d="M488 261.8C488 403.3 391.1 504 248 504 110.8 504 0 393.2 0 256S110.8 8 248 8c66.8 0 123 24.5 166.3 64.9l-67.5 64.9C258.5 52.6 94.3 116.6 94.3 256c0 86.5 69.1 156.6 153.7 156.6 98.2 0 135-70.4 140.8-106.9H248v-85.3h236.1c2.3 12.7 3.9 24.9 3.9 41.4z" />
|
|
46
|
+
</svg>
|
|
47
|
+
</LoginMainFooterLinksItem>
|
|
48
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Github' }}>
|
|
49
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
|
|
50
|
+
<path d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6-3.3.3-5.6-1.3-5.6-3.6 0-2 2.3-3.6 5.2-3.6 3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9 2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9.3 2 2.9 3.3 5.9 2.6 2.9-.7 4.9-2.6 4.6-4.6-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2 12.8 2.3 17.3-5.6 17.3-12.1 0-6.2-.3-40.4-.3-61.4 0 0-70 15-84.7-29.8 0 0-11.4-29.1-27.8-36.6 0 0-22.9-15.7 1.6-15.4 0 0 24.9 2 38.6 25.8 21.9 38.6 58.6 27.5 72.9 20.9 2.3-16 8.8-27.1 16-33.7-55.9-6.2-112.3-14.3-112.3-110.5 0-27.5 7.6-41.3 23.6-58.9-2.6-6.5-11.1-33.3 2.6-67.9 20.9-6.5 69 27 69 27 20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27 13.7 34.7 5.2 61.4 2.6 67.9 16 17.7 25.8 31.5 25.8 58.9 0 96.5-58.9 104.2-114.8 110.5 9.2 7.9 17 22.9 17 46.4 0 33.7-.3 75.4-.3 83.6 0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252 496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2 1.6 1.6 3.9 2.3 5.2 1 1.3-1 1-3.3-.7-5.2-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9 1.6 1 3.6.7 4.3-.7.7-1.3-.3-2.9-2.3-3.9-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2 2.3 2.3 5.2 2.6 6.5 1 1.3-1.3.7-4.3-1.3-6.2-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9 1.6 2.3 4.3 3.3 5.6 2.3 1.6-1.3 1.6-3.9 0-6.2-1.4-2.3-4-3.3-5.6-2z" />
|
|
51
|
+
</svg>
|
|
52
|
+
</LoginMainFooterLinksItem>
|
|
53
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Dropbox' }}>
|
|
54
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 528 512">
|
|
55
|
+
<path d="M264.4 116.3l-132 84.3 132 84.3-132 84.3L0 284.1l132.3-84.3L0 116.3 132.3 32l132.1 84.3zM131.6 395.7l132-84.3 132 84.3-132 84.3-132-84.3zm132.8-111.6l132-84.3-132-83.6L395.7 32 528 116.3l-132.3 84.3L528 284.8l-132.3 84.3-131.3-85z" />
|
|
56
|
+
</svg>
|
|
57
|
+
</LoginMainFooterLinksItem>
|
|
58
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Facebook' }}>
|
|
59
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
|
|
60
|
+
<path d="M448 56.7v398.5c0 13.7-11.1 24.7-24.7 24.7H309.1V306.5h58.2l8.7-67.6h-67v-43.2c0-19.6 5.4-32.9 33.5-32.9h35.8v-60.5c-6.2-.8-27.4-2.7-52.2-2.7-51.6 0-87 31.5-87 89.4v49.9h-58.4v67.6h58.4V480H24.7C11.1 480 0 468.9 0 455.3V56.7C0 43.1 11.1 32 24.7 32h398.5c13.7 0 24.8 11.1 24.8 24.7z" />
|
|
61
|
+
</svg>
|
|
62
|
+
</LoginMainFooterLinksItem>
|
|
63
|
+
<LoginMainFooterLinksItem href="#" linkComponentProps={{ 'aria-label': 'Login with Gitlab' }}>
|
|
64
|
+
<svg aria-hidden="true" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
65
|
+
<path d="M29.782 199.732L256 493.714 8.074 309.699c-6.856-5.142-9.712-13.996-7.141-21.993l28.849-87.974zm75.405-174.806c-3.142-8.854-15.709-8.854-18.851 0L29.782 199.732h131.961L105.187 24.926zm56.556 174.806L256 493.714l94.257-293.982H161.743zm349.324 87.974l-28.849-87.974L256 493.714l247.926-184.015c6.855-5.142 9.711-13.996 7.141-21.993zm-85.404-262.78c-3.142-8.854-15.709-8.854-18.851 0l-56.555 174.806h131.961L425.663 24.926z" />
|
|
66
|
+
</svg>
|
|
67
|
+
</LoginMainFooterLinksItem>
|
|
68
|
+
</React.Fragment>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
const signUpForAccountMessage = (
|
|
72
|
+
<LoginMainFooterBandItem>
|
|
73
|
+
Need an account? <a href="#">Sign up.</a>
|
|
74
|
+
</LoginMainFooterBandItem>
|
|
75
|
+
);
|
|
76
|
+
|
|
77
|
+
const forgotCredentials = (
|
|
78
|
+
<LoginMainFooterBandItem>
|
|
79
|
+
<a href="#">Forgot username or password?</a>
|
|
80
|
+
</LoginMainFooterBandItem>
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
const listItem = (
|
|
84
|
+
<React.Fragment>
|
|
85
|
+
<ListItem>
|
|
86
|
+
<LoginFooterItem href="#">Terms of Use </LoginFooterItem>
|
|
87
|
+
</ListItem>
|
|
88
|
+
<ListItem>
|
|
89
|
+
<LoginFooterItem href="#">Help</LoginFooterItem>
|
|
90
|
+
</ListItem>
|
|
91
|
+
<ListItem>
|
|
92
|
+
<LoginFooterItem href="#">Privacy Policy</LoginFooterItem>
|
|
93
|
+
</ListItem>
|
|
94
|
+
</React.Fragment>
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
const loginForm = (
|
|
98
|
+
<LoginForm
|
|
99
|
+
showHelperText={showHelperText}
|
|
100
|
+
helperText="Invalid login credentials."
|
|
101
|
+
helperTextIcon={<ExclamationCircleIcon />}
|
|
102
|
+
usernameLabel="Username"
|
|
103
|
+
usernameValue={username}
|
|
104
|
+
onChangeUsername={handleUsernameChange}
|
|
105
|
+
isValidUsername={isValidUsername}
|
|
106
|
+
passwordLabel="Password"
|
|
107
|
+
passwordValue={password}
|
|
108
|
+
isShowPasswordEnabled
|
|
109
|
+
onChangePassword={handlePasswordChange}
|
|
110
|
+
isValidPassword={isValidPassword}
|
|
111
|
+
rememberMeLabel="Keep me logged in for 30 days."
|
|
112
|
+
isRememberMeChecked={isRememberMeChecked}
|
|
113
|
+
onChangeRememberMe={onRememberMeClick}
|
|
114
|
+
onLoginButtonClick={onLoginButtonClick}
|
|
115
|
+
loginButtonLabel="Log in"
|
|
116
|
+
/>
|
|
117
|
+
);
|
|
118
|
+
|
|
119
|
+
const images = {
|
|
120
|
+
lg: '/assets/images/pfbg_1200.jpg',
|
|
121
|
+
sm: '/assets/images/pfbg_768.jpg',
|
|
122
|
+
sm2x: '/assets/images/pfbg_768@2x.jpg',
|
|
123
|
+
xs: '/assets/images/pfbg_576.jpg',
|
|
124
|
+
xs2x: '/assets/images/pfbg_576@2x.jpg'
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<LoginPage
|
|
129
|
+
footerListVariants={ListVariant.inline}
|
|
130
|
+
brandImgSrc={brandImg2}
|
|
131
|
+
brandImgAlt="PatternFly logo"
|
|
132
|
+
backgroundImgSrc={images}
|
|
133
|
+
backgroundImgAlt="Images"
|
|
134
|
+
footerListItems={listItem}
|
|
135
|
+
textContent="This is placeholder text only. Use this area to place any information or introductory message about your application that may be relevant to users."
|
|
136
|
+
loginTitle="Log in to your account"
|
|
137
|
+
loginSubtitle="Enter your single sign-on LDAP credentials."
|
|
138
|
+
socialMediaLoginContent={socialMediaLoginContent}
|
|
139
|
+
signUpForAccountMessage={signUpForAccountMessage}
|
|
140
|
+
forgotCredentials={forgotCredentials}
|
|
141
|
+
>
|
|
142
|
+
{loginForm}
|
|
143
|
+
</LoginPage>
|
|
144
|
+
);
|
|
145
|
+
};
|