@@ -10,6 +10,8 @@ import { withFirebase } from '../Firebase';
10
10
import { PasswordForgetForm } from '../PasswordForget' ;
11
11
import PasswordChangeForm from '../PasswordChange' ;
12
12
13
+ import { Grid , Card , Header , Message , Form , Button } from 'semantic-ui-react'
14
+
13
15
const SIGN_IN_METHODS = [
14
16
{
15
17
id : 'password' ,
@@ -33,9 +35,29 @@ const AccountPage = () => (
33
35
< AuthUserContext . Consumer >
34
36
{ authUser => (
35
37
< 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 >
39
61
< LoginManagement authUser = { authUser } />
40
62
</ div >
41
63
) }
@@ -95,40 +117,51 @@ class LoginManagementBase extends Component {
95
117
const { activeSignInMethods, error } = this . state ;
96
118
97
119
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 >
132
165
) ;
133
166
}
134
167
}
@@ -141,20 +174,22 @@ const SocialLoginToggle = ({
141
174
onUnlink,
142
175
} ) =>
143
176
isEnabled ? (
144
- < button
177
+ < Button
178
+ color = { signInMethod . id === 'google.com' ? 'google plus' : signInMethod . id === 'facebook.com' ? 'facebook' : signInMethod . id === 'twitter.com' ? 'twitter' : '' }
145
179
type = "button"
146
180
onClick = { ( ) => onUnlink ( signInMethod . id ) }
147
181
disabled = { onlyOneLeft }
148
182
>
149
183
Deactivate { signInMethod . id }
150
- </ button >
184
+ </ Button >
151
185
) : (
152
- < button
186
+ < Button
187
+ color = { signInMethod . id === 'google.com' ? 'google plus' : signInMethod . id === 'facebook.com' ? 'facebook' : signInMethod . id === 'twitter.com' ? 'twitter' : '' }
153
188
type = "button"
154
189
onClick = { ( ) => onLink ( signInMethod . provider ) }
155
190
>
156
191
Link { signInMethod . id }
157
- </ button >
192
+ </ Button >
158
193
) ;
159
194
160
195
class DefaultLoginToggle extends Component {
@@ -189,34 +224,40 @@ class DefaultLoginToggle extends Component {
189
224
passwordOne !== passwordTwo || passwordOne === '' ;
190
225
191
226
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 >
199
233
) : (
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" >
217
258
Link { signInMethod . id }
218
- </ button >
219
- </ form >
259
+ </ Button >
260
+ </ Form >
220
261
) ;
221
262
}
222
263
}
0 commit comments