File tree Expand file tree Collapse file tree 3 files changed +38
-2
lines changed
src/projects/authentication Expand file tree Collapse file tree 3 files changed +38
-2
lines changed Original file line number Diff line number Diff line change
1
+ import React , { useState } from 'react'
2
+ import { Prompt } from 'react-router-dom'
3
+ import Card from '../../ui/Card'
4
+
5
+ const AddUser = ( ) => {
6
+ const [ formIsDirty , setFormIsDirty ] = useState ( false )
7
+
8
+ function handleSubmit ( e ) {
9
+ e . preventDefault ( )
10
+ console . log ( 'submit' )
11
+ }
12
+
13
+ return (
14
+ < Card style = { { minHeight : '20em' } } >
15
+ < Prompt when = { formIsDirty } message = "Are you sure you want to leave this form before saving?" />
16
+ < form className = "spacing" onSubmit = { handleSubmit } >
17
+ < input onChange = { ( ) => setFormIsDirty ( true ) } type = "text" placeholder = "Email" required />
18
+ < input onChange = { ( ) => setFormIsDirty ( true ) } type = "password" placeholder = "Password" required />
19
+ < button type = "submit" className = "button" >
20
+ Add User
21
+ </ button >
22
+ </ form >
23
+ </ Card >
24
+ )
25
+ }
26
+
27
+ export default AddUser
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import Panel from '../../ui/Panel'
4
4
import PageHeader from '../../ui/PageHeader'
5
5
import { PageHeaderTabs , Tab } from '../../ui/PageHeaderTabs'
6
6
import Users from './Users'
7
+ import AddUser from './AddUser'
7
8
import SigninMethods from './SigninMethods'
8
9
import Templates from './Templates'
9
10
@@ -19,6 +20,7 @@ const AuthenticationLayout = ({ match }) => {
19
20
</ PageHeader >
20
21
< Panel >
21
22
< Switch >
23
+ < Route path = { `${ match . path } /users/add-user` } component = { AddUser } />
22
24
< Route path = { `${ match . path } /users` } component = { Users } />
23
25
< Route path = { `${ match . path } /signin-method` } component = { SigninMethods } />
24
26
< Route path = { `${ match . path } /templates` } component = { Templates } />
Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
+ import { Link } from 'react-router-dom'
2
3
import Card from '../../ui/Card'
3
4
4
- const Users = ( ) => {
5
- return < Card style = { { height : '20em' } } > Users</ Card >
5
+ const Users = ( { match } ) => {
6
+ return (
7
+ < Card style = { { height : '20em' } } >
8
+ < Link to = { `${ match . url } /add-user` } className = "button" >
9
+ Add User
10
+ </ Link >
11
+ </ Card >
12
+ )
6
13
}
7
14
8
15
export default Users
You can’t perform that action at this time.
0 commit comments