Skip to content

Commit 332cfbd

Browse files
committed
code tydyup
1 parent 254e509 commit 332cfbd

File tree

7 files changed

+19
-439
lines changed

7 files changed

+19
-439
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The components allow very easy control via props to change page titles, submit b
1111
<br />
1212

1313
### How you would add new pages?
14-
The app uses a 'views' approach, so new components can easily be added to the signup view page by linking to new components from the componenets directory. Then also adding them to the progress component in the signup views page too.
14+
The app uses a 'views' approach, so new components can easily be added to the signup view page by linking to new components from the components directory. Then also adding them to the progress component in the signup views page too.
1515
<br />
1616

1717
### How you would implement going back a page?
@@ -20,18 +20,18 @@ The components feature props to enable/disable a dynamic 'Back' button as outlin
2020

2121

2222
## Features
23-
- Mult-Step Signup Form
23+
- Multi-Step Signup Form
2424
- Form Progression Path
2525
- Modular/Scalable App
2626
- Form Validation
2727
- Custom fav icon
28-
- Lazyloading for image and components
29-
- React Testing Library pass???
28+
- Lazy Loading for image and components
29+
- React Testing Library pass
3030
- PWA testing pass
3131
- Lighthouse testing pass
3232
- HTML testing pass
3333
- CSS testing pass
34-
- Accesability testing pass
34+
- Accessibility testing pass
3535
<br />
3636

3737
## Run

src/components/form-completed/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,11 @@ function FormUserResult({ pageTitle, successMessage }) {
2222
<img
2323
className="fade-in-image"
2424
src={IMGgreentick}
25-
alt={successMessage || 'Thanks1!'}
25+
alt={successMessage || 'Success!'}
2626
/>
2727

2828
<p>
29-
{successMessage || 'Thanks2!'}
29+
{successMessage || 'Thank you, please check your email1!'}
3030
</p>
3131

3232
</div>

src/components/form-privacy/index.js

Lines changed: 11 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -8,48 +8,32 @@ function FormUserPrivacy({ pageTitle, submitButtonText, previousButton }) {
88
// redux
99
const dispatch = useDispatch();
1010

11+
// get Redux store values for formUserPrivacy
1112
const currentStage = useSelector(state => state.FormStage) // for previous button
1213
const stateSignup1 = useSelector(state => state.FormUserPrivacy.signup1)
1314
const stateSignup2 = useSelector(state => state.FormUserPrivacy.signup2)
1415

15-
//const stateAll = useSelector(state => state)
16-
//console.log(`output: ${JSON.stringify(stateAll, null, 2)}`) // output results to console.log
17-
18-
1916
// form values initial state - getting from redux
2017
const [formData, setFormData] = useState({
21-
//signup1: stateSignup1 === "yes" ? true : false,
22-
//signup2: stateSignup2 === "yes" ? true : false
23-
24-
//signup1: stateSignup1 ? true : 'false1',
25-
//signup2: stateSignup2 ? true : 'false2'
26-
27-
signup1: stateSignup1 ? true : false,
28-
signup2: stateSignup2 ? true : false
29-
30-
//signup1: stateSignup1 || false,
31-
//signup2: stateSignup2 || false
32-
33-
//signup1: stateSignup1, // add if empty then false!
34-
//signup2: stateSignup2
18+
signup1: stateSignup1,
19+
signup2: stateSignup2
3520
})
3621

37-
3822
// form values onchange
3923
const [isChecked1, setIsChecked1] = useState(formData.signup1);
4024
const [isChecked2, setIsChecked2] = useState(formData.signup2);
4125

26+
// form values onchange
4227
const handleChange1 = (e) => {
4328
setIsChecked1(!isChecked1);
44-
isChecked1 ? setFormData({signup1: true }) : setFormData({signup1: false })
29+
!isChecked1 ? setFormData({signup1: true }) : setFormData({signup1: false })
4530
}
4631
const handleChange2 = (e) => {
4732
setIsChecked2(!isChecked2);
48-
isChecked2 ? setFormData({signup2: true }) : setFormData({signup2: false })
33+
!isChecked2 ? setFormData({signup2: true }) : setFormData({signup2: false })
4934
}
5035

5136
// onsubmit
52-
//const handleSubmit = (e) => {
5337
const handleSubmit = (e) => {
5438
e.preventDefault(); // stop form submission
5539

@@ -61,21 +45,17 @@ function FormUserPrivacy({ pageTitle, submitButtonText, previousButton }) {
6145

6246
// update Redux Slice
6347
dispatch(
64-
formStage(3) // update formStage
48+
formStage(3) // update formStage and move to next stage
6549
)
6650
dispatch(
6751
formPrivacy({
68-
//signup1: formData.signup1,
69-
//signup2: formData.signup2
70-
71-
signup1: formData.signup1 ? true : false,
72-
signup2: formData.signup2 ? true : false
52+
signup1: formData.signup1,
53+
signup2: formData.signup2
7354
})
7455
);
7556

7657
}
7758

78-
7959
return (
8060

8161
<>
@@ -94,11 +74,9 @@ function FormUserPrivacy({ pageTitle, submitButtonText, previousButton }) {
9474
id="signup1"
9575
name="signup1"
9676
//value={formData.signup1}
97-
checked={!!formData.signup1}
98-
//checked={isChecked1}
9977
//onClick={handleChange1}
78+
//onChange={handleChange1}
10079
onChange={(e) => handleChange1(e)}
101-
//checked
10280
/>
10381
<label htmlFor="signup1">Recieve updates about Tray.io product by email</label>
10482
</p>
@@ -109,11 +87,9 @@ function FormUserPrivacy({ pageTitle, submitButtonText, previousButton }) {
10987
id="signup2"
11088
name="signup2"
11189
//value={formData.signup2}
112-
checked={!!formData.signup2}
113-
//checked={isChecked2}
11490
//onClick={handleChange2}
91+
//onChange={handleChange2}
11592
onChange={(e) => handleChange2(e)}
116-
//checked
11793
/>
11894
<label htmlFor="signup2">Recieve communication by email for other products created by the Tray.io team</label>
11995
</p>

src/components/form-privacy/old/index copy 2.js

Lines changed: 0 additions & 145 deletions
This file was deleted.

0 commit comments

Comments
 (0)