File tree 4 files changed +31
-29
lines changed
4 files changed +31
-29
lines changed Original file line number Diff line number Diff line change 1
1
import { Button , Text , Image , Flex } from 'theme-ui'
2
2
import Icon from '../icon'
3
+ import Link from 'next/link'
3
4
4
5
export default function ApplyButton ( ) {
5
6
return (
6
- < Button
7
- variant = "ctaLg"
8
- as = "a"
9
- href = "/hcb/apply"
10
- sx = { {
11
- width : '100%' ,
12
- height : '4.2rem'
13
- // borderRadius: '1.5rem',
14
- } }
15
- >
16
- < Flex
7
+ < Link href = "/hcb/apply" passHref legacyBehavior >
8
+ < Button
9
+ variant = "ctaLg"
10
+ as = "a"
17
11
sx = { {
18
- alignItems : 'center ' ,
19
- gap : 3 ,
20
- mr : '-32px' // Man...
12
+ width : '100% ' ,
13
+ height : '4.2rem'
14
+ // borderRadius: '1.5rem',
21
15
} }
22
16
>
23
- < Text color = "white" sx = { { fontWeight : 'bold' , fontSize : 4 } } >
24
- Apply now
25
- </ Text >
26
- < Icon glyph = "view-forward" size = { 46 } color = "white" />
27
- </ Flex >
28
- </ Button >
17
+ < Flex
18
+ sx = { {
19
+ alignItems : 'center' ,
20
+ gap : 3 ,
21
+ mr : '-32px' // Man...
22
+ } }
23
+ >
24
+ < Text color = "white" sx = { { fontWeight : 'bold' , fontSize : 4 } } >
25
+ Apply now
26
+ </ Text >
27
+ < Icon glyph = "view-forward" size = { 46 } color = "white" />
28
+ </ Flex >
29
+ </ Button >
30
+ </ Link >
29
31
)
30
32
}
Original file line number Diff line number Diff line change 1
1
import { useEffect , useState } from 'react'
2
2
import Icon from '../../icon'
3
+ import { useRouter } from 'next/router'
3
4
4
5
export default function Checkbox ( { name, defaultChecked = false , size = 38 } ) {
5
6
const [ checked , setChecked ] = useState ( defaultChecked )
6
7
const toggle = ( ) => setChecked ( ! checked )
8
+ const router = useRouter ( )
7
9
8
10
/* Fill in the field with the value from sessionStorage.
9
11
For other input elements, the value is set in the Field component,
10
12
but these checkboxes hold their state in useState rather than in the DOM. */
11
13
useEffect ( ( ) => {
12
- const value = sessionStorage . getItem ( 'bank-signup-' + name )
14
+ const value = router . query [ name ] || sessionStorage . getItem ( 'bank-signup-' + name )
13
15
if ( value ) {
14
16
const input = document . getElementById ( name )
15
- input && setChecked ( value === 'true' )
17
+ input && setChecked ( ! ! value )
16
18
}
17
- } , [ name ] )
19
+ } , [ router . query , name ] )
18
20
19
21
return (
20
22
< >
Original file line number Diff line number Diff line change @@ -18,12 +18,12 @@ export default function Field({
18
18
/* Fill in the field input element with the value from sessionStorage.
19
19
Note: the custom checkbox component does this in its own useEffect hook. */
20
20
useEffect ( ( ) => {
21
- const value = sessionStorage . getItem ( 'bank-signup-' + name )
21
+ const value = router . query [ name ] || sessionStorage . getItem ( 'bank-signup-' + name )
22
22
if ( value ) {
23
23
const input = document . getElementById ( name )
24
24
if ( input ) input . value = value
25
25
}
26
- } , [ name ] )
26
+ } , [ router . query , name ] )
27
27
28
28
return (
29
29
< FlexCol gap = { 2 } width = { '100%' } >
Original file line number Diff line number Diff line change @@ -67,7 +67,7 @@ export default function Apply() {
67
67
68
68
// Set the query url parameter to 1 if it's not present
69
69
if ( ! step || step < 1 ) {
70
- router . push (
70
+ router . replace (
71
71
{
72
72
pathname : router . pathname ,
73
73
query : { ...router . query , step : 1 }
@@ -110,9 +110,7 @@ export default function Apply() {
110
110
< Box sx = { { gridArea : 'form' , overflowY : 'auto' } } >
111
111
< FormContainer ref = { formContainer } >
112
112
{ step === 1 && < HCBInfo /> }
113
- { step === 2 && (
114
- < OrganizationInfoForm requiredFields = { requiredFields } />
115
- ) }
113
+ { step === 2 && < OrganizationInfoForm requiredFields = { requiredFields } /> }
116
114
{ step === 3 && < PersonalInfoForm requiredFields = { requiredFields } /> }
117
115
</ FormContainer >
118
116
</ Box >
You can’t perform that action at this time.
0 commit comments