@@ -10,6 +10,8 @@ import { withFirebase } from '../Firebase';
1010import { PasswordForgetForm } from '../PasswordForget' ;
1111import PasswordChangeForm from '../PasswordChange' ;
1212
13+ import { Grid , Card , Header , Message , Form , Button } from 'semantic-ui-react'
14+
1315const SIGN_IN_METHODS = [
1416 {
1517 id : 'password' ,
@@ -33,9 +35,29 @@ const AccountPage = () => (
3335 < AuthUserContext . Consumer >
3436 { authUser => (
3537 < div >
36- < h1 > Account: { authUser . email } </ h1 >
37- < PasswordForgetForm />
38- < PasswordChangeForm />
38+ < Header as = 'h2' > Account: { authUser . email } </ Header >
39+ < Grid columns = { 2 } >
40+ < Grid . Column >
41+ < Card fluid = { true } >
42+ < Card . Content >
43+ < Card . Header > Reset Password</ Card . Header >
44+ < Card . Description >
45+ < PasswordForgetForm />
46+ </ Card . Description >
47+ </ Card . Content >
48+ </ Card >
49+ </ Grid . Column >
50+ < Grid . Column >
51+ < Card fluid = { true } >
52+ < Card . Content >
53+ < Card . Header > New Password</ Card . Header >
54+ < Card . Description >
55+ < PasswordChangeForm />
56+ </ Card . Description >
57+ </ Card . Content >
58+ </ Card >
59+ </ Grid . Column >
60+ </ Grid >
3961 < LoginManagement authUser = { authUser } />
4062 </ div >
4163 ) }
@@ -95,40 +117,51 @@ class LoginManagementBase extends Component {
95117 const { activeSignInMethods, error } = this . state ;
96118
97119 return (
98- < div >
99- Sign In Methods:
100- < ul >
101- { SIGN_IN_METHODS . map ( signInMethod => {
102- const onlyOneLeft = activeSignInMethods . length === 1 ;
103- const isEnabled = activeSignInMethods . includes (
104- signInMethod . id ,
105- ) ;
106-
107- return (
108- < li key = { signInMethod . id } >
109- { signInMethod . id === 'password' ? (
110- < DefaultLoginToggle
111- onlyOneLeft = { onlyOneLeft }
112- isEnabled = { isEnabled }
113- signInMethod = { signInMethod }
114- onLink = { this . onDefaultLoginLink }
115- onUnlink = { this . onUnlink }
116- />
117- ) : (
118- < SocialLoginToggle
119- onlyOneLeft = { onlyOneLeft }
120- isEnabled = { isEnabled }
121- signInMethod = { signInMethod }
122- onLink = { this . onSocialLoginLink }
123- onUnlink = { this . onUnlink }
124- />
125- ) }
126- </ li >
127- ) ;
128- } ) }
129- </ ul >
130- { error && error . message }
131- </ div >
120+ < Card fluid = { true } >
121+ < Card . Content >
122+ < Card . Header > Sign In Methods</ Card . Header >
123+ < Card . Description >
124+ { error && < Message negative >
125+ < p > { error . message } </ p >
126+ </ Message > }
127+ < div >
128+ { SIGN_IN_METHODS . map ( signInMethod => {
129+ const onlyOneLeft = activeSignInMethods . length === 1 ;
130+ const isEnabled = activeSignInMethods . includes (
131+ signInMethod . id ,
132+ ) ;
133+
134+ return (
135+ < span key = { signInMethod . id } >
136+ { signInMethod . id === 'password' ? (
137+ < Grid columns = { 1 } >
138+ < Grid . Column >
139+ < DefaultLoginToggle
140+ onlyOneLeft = { onlyOneLeft }
141+ isEnabled = { isEnabled }
142+ signInMethod = { signInMethod }
143+ onLink = { this . onDefaultLoginLink }
144+ onUnlink = { this . onUnlink }
145+ />
146+ < br />
147+ </ Grid . Column >
148+ </ Grid >
149+ ) : (
150+ < SocialLoginToggle
151+ onlyOneLeft = { onlyOneLeft }
152+ isEnabled = { isEnabled }
153+ signInMethod = { signInMethod }
154+ onLink = { this . onSocialLoginLink }
155+ onUnlink = { this . onUnlink }
156+ />
157+ ) }
158+ </ span >
159+ ) ;
160+ } ) }
161+ </ div >
162+ </ Card . Description >
163+ </ Card . Content >
164+ </ Card >
132165 ) ;
133166 }
134167}
@@ -141,20 +174,22 @@ const SocialLoginToggle = ({
141174 onUnlink,
142175} ) =>
143176 isEnabled ? (
144- < button
177+ < Button
178+ color = { signInMethod . id === 'google.com' ? 'google plus' : signInMethod . id === 'facebook.com' ? 'facebook' : signInMethod . id === 'twitter.com' ? 'twitter' : '' }
145179 type = "button"
146180 onClick = { ( ) => onUnlink ( signInMethod . id ) }
147181 disabled = { onlyOneLeft }
148182 >
149183 Deactivate { signInMethod . id }
150- </ button >
184+ </ Button >
151185 ) : (
152- < button
186+ < Button
187+ color = { signInMethod . id === 'google.com' ? 'google plus' : signInMethod . id === 'facebook.com' ? 'facebook' : signInMethod . id === 'twitter.com' ? 'twitter' : '' }
153188 type = "button"
154189 onClick = { ( ) => onLink ( signInMethod . provider ) }
155190 >
156191 Link { signInMethod . id }
157- </ button >
192+ </ Button >
158193 ) ;
159194
160195class DefaultLoginToggle extends Component {
@@ -189,34 +224,40 @@ class DefaultLoginToggle extends Component {
189224 passwordOne !== passwordTwo || passwordOne === '' ;
190225
191226 return isEnabled ? (
192- < button
193- type = "button"
194- onClick = { ( ) => onUnlink ( signInMethod . id ) }
195- disabled = { onlyOneLeft }
196- >
197- Deactivate { signInMethod . id }
198- </ button >
227+ < span >
228+ < Button type = "button" onClick = { ( ) => onUnlink ( signInMethod . id ) } disabled = { onlyOneLeft } >
229+ Deactivate { signInMethod . id }
230+ </ Button >
231+ < br />
232+ </ span >
199233 ) : (
200- < form onSubmit = { this . onSubmit } >
201- < input
202- name = "passwordOne"
203- value = { passwordOne }
204- onChange = { this . onChange }
205- type = "password"
206- placeholder = "New Password"
207- />
208- < input
209- name = "passwordTwo"
210- value = { passwordTwo }
211- onChange = { this . onChange }
212- type = "password"
213- placeholder = "Confirm New Password"
214- />
215-
216- < button disabled = { isInvalid } type = "submit" >
234+ < Form onSubmit = { this . onSubmit } >
235+ < Form . Group widths = 'equal' >
236+ < Form . Field >
237+ < label > New Password</ label >
238+ < input
239+ name = "passwordOne"
240+ value = { passwordOne }
241+ onChange = { this . onChange }
242+ type = "password"
243+ placeholder = "New Password"
244+ />
245+ </ Form . Field >
246+ < Form . Field >
247+ < label > Confirm Password</ label >
248+ < input
249+ name = "passwordTwo"
250+ value = { passwordTwo }
251+ onChange = { this . onChange }
252+ type = "password"
253+ placeholder = "Confirm New Password"
254+ />
255+ </ Form . Field >
256+ </ Form . Group >
257+ < Button primary disabled = { isInvalid } type = "submit" >
217258 Link { signInMethod . id }
218- </ button >
219- </ form >
259+ </ Button >
260+ </ Form >
220261 ) ;
221262 }
222263}
0 commit comments