@@ -3,26 +3,27 @@ import createRecord from '../../helpers/airtable'
3
3
import { Button , Form } from './elements'
4
4
5
5
export default ( { onSubmit, city } ) => {
6
- const [ plus , setPlus ] = useState ( false )
7
- const [ plusOneName , setPlusOneName ] = useState ( '' )
8
6
const [ name , setName ] = useState ( '' )
9
7
const [ gh , setGH ] = useState ( '' )
8
+ const [ plusOne , setPlusOne ] = useState ( false )
9
+ const [ plusOneName , setPlusOneName ] = useState ( '' )
10
+ const [ plusOneGH , setPlusOneGH ] = useState ( '' )
10
11
11
12
const createUser = ( ) => {
12
13
if ( name && gh ) {
13
- if ( plus && ! plusOneName ) return
14
+ if ( plusOne && ! plusOneName ) return
14
15
15
16
createRecord ( {
16
17
city : city ,
17
18
name : name ,
18
- ghLink : gh
19
+ ghLink : gh || 'QueerJS'
19
20
} )
20
21
21
- if ( plus ) {
22
+ if ( plusOne ) {
22
23
createRecord ( {
23
24
city : city ,
24
25
name : plusOneName ,
25
- ghLink : 'queerjs '
26
+ ghLink : plusOneGH || 'QueerJS '
26
27
} )
27
28
}
28
29
}
@@ -37,8 +38,8 @@ export default ({ onSubmit, city }) => {
37
38
} }
38
39
>
39
40
< p >
40
- If you're not comfortable showing your photo and link please put `QueerJS` in the `Github
41
- Username` input field .
41
+ If you're not comfortable showing your photo and link, you may leave the `GitHub Handle` field blank and it will default
42
+ to `QueerJS` .
42
43
</ p >
43
44
< label htmlFor = "name" >
44
45
Your Name
@@ -53,15 +54,14 @@ export default ({ onSubmit, city }) => {
53
54
/>
54
55
</ label >
55
56
< label htmlFor = "gh" >
56
- Github Username
57
+ Github Handle
57
58
< input
58
- required
59
59
id = "gh"
60
60
type = "text"
61
61
placeholder = "QueerJS"
62
62
pattern = "[A-Za-z0-9-]{1,30}"
63
63
value = { gh }
64
- onInvalid = { e => e . target . setCustomValidity ( `Your username , e.g. 'QueerJS' for 'https://github.com/queerjs'` ) }
64
+ onInvalid = { e => e . target . setCustomValidity ( `A GitHub handle , e.g. 'QueerJS' for 'https://github.com/queerjs'` ) }
65
65
onChange = { e => setGH ( e . target . value . trim ( ) ) }
66
66
/>
67
67
</ label >
@@ -75,16 +75,16 @@ export default ({ onSubmit, city }) => {
75
75
id = "plus-one"
76
76
type = "checkbox"
77
77
pattern = "[a-zA-Z0-9]+"
78
- value = { plus }
78
+ value = { plusOne }
79
79
css = { `
80
80
width: auto !important;
81
81
margin-right: 12px !important;
82
82
` }
83
- onChange = { e => setPlus ( e . target . checked ) }
83
+ onChange = { e => setPlusOne ( e . target . checked ) }
84
84
/>
85
85
< span > I am taking a plus one</ span >
86
86
</ label >
87
- { plus && (
87
+ { plusOne && (
88
88
< label htmlFor = "plus-one-name" >
89
89
+1 Name
90
90
< input
@@ -96,6 +96,20 @@ export default ({ onSubmit, city }) => {
96
96
/>
97
97
</ label >
98
98
) }
99
+ { plusOne && (
100
+ < label htmlFor = "plus-one-gh" >
101
+ +1 Github Handle
102
+ < input
103
+ id = "plus-one-gh"
104
+ type = "text"
105
+ placeholder = "QueerJS"
106
+ pattern = "[A-Za-z0-9-]{1,30}"
107
+ value = { plusOneGH }
108
+ onInvalid = { e => e . target . setCustomValidity ( `A GitHub handle, e.g. 'QueerJS' for 'https://github.com/queerjs'` ) }
109
+ onChange = { e => setPlusOneGH ( e . target . value . trim ( ) ) }
110
+ />
111
+ </ label >
112
+ ) }
99
113
100
114
< Button >
101
115
I AM IN{ ' ' }
0 commit comments