Skip to content

Commit 5dd355b

Browse files
committed
fix: add lint & prettier
Initiated a lint and prettier step to enforce uniformity with the rest of the code
1 parent 4ff729d commit 5dd355b

2 files changed

Lines changed: 99 additions & 86 deletions

File tree

src/components/ContactUs/DesktopVersion.tsx

Lines changed: 49 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,31 @@
11
/* eslint-disable @typescript-eslint/no-non-null-assertion */
22
import { useState } from 'react';
33

4-
import {useForm, ValidationError} from '@formspree/react';
4+
import { useForm, ValidationError } from '@formspree/react';
55

6-
import ReCAPTCHA from "react-google-recaptcha";
6+
import ReCAPTCHA from 'react-google-recaptcha';
77

88
export default function DesktopVersion() {
9+
const [captchaComplete, setCaptchaComplete] = useState<boolean>(false);
910

10-
const [captchaComplete, setCaptchaComplete] = useState<boolean>(false);
11+
const [state, handleSubmit] = useForm(process.env.NEXT_PUBLIC_FORMSPREE_ID!);
1112

12-
const [state, handleSubmit] = useForm(process.env.NEXT_PUBLIC_FORMSPREE_ID!);
13-
14-
const handleRecaptchaResult = (result: string | null) => {
15-
if (result) {
16-
setCaptchaComplete(true);
17-
}
13+
const handleRecaptchaResult = (result: string | null) => {
14+
if (result) {
15+
setCaptchaComplete(true);
1816
}
17+
};
1918

20-
if (state.succeeded) {
21-
return (
22-
<div className="flex justify-center items-center">
23-
<p className='text-xl font-medium text-green-800'>Thank you for your submission. We will get back to you as soon as possible</p>
24-
</div>
25-
)
26-
}
19+
if (state.succeeded) {
20+
return (
21+
<div className="flex justify-center items-center">
22+
<p className="text-xl font-medium text-green-800">
23+
Thank you for your submission. We will get back to you as soon as
24+
possible
25+
</p>
26+
</div>
27+
);
28+
}
2729

2830
return (
2931
<>
@@ -40,8 +42,8 @@ export default function DesktopVersion() {
4042
</label>
4143
<input
4244
id="name"
43-
type='text'
44-
name='name'
45+
type="text"
46+
name="name"
4547
placeholder={'Jane Doe'}
4648
className="border border-[#CEEDF4] w-full rounded-lg px-4 py-3 mb-5 placeholder-[#7E7979] outline-none font-montserrat text-base"
4749
required
@@ -55,8 +57,8 @@ export default function DesktopVersion() {
5557
</label>
5658
<input
5759
id="email"
58-
type='email'
59-
name='email'
60+
type="email"
61+
name="email"
6062
placeholder={'you@example.com'}
6163
className="border border-[#CEEDF4] w-full rounded-lg px-4 py-3 mb-5 outline-none placeholder-[#7E7979] font-montserrat text-base"
6264
required
@@ -70,35 +72,41 @@ export default function DesktopVersion() {
7072
</label>
7173
<textarea
7274
id="message"
73-
name='message'
75+
name="message"
7476
placeholder="Hello, I'm getting in touch ..."
7577
className="border border-[#CEEDF4] w-full rounded-lg px-4 py-[22px] mb-9 h-[178px] resize-none outline-none placeholder-[#7E7979] font-montserrat text-base"
7678
required
7779
/>
78-
<ValidationError prefix="Message" field="message" errors={state.errors} />
80+
<ValidationError
81+
prefix="Message"
82+
field="message"
83+
errors={state.errors}
84+
/>
7985
{/*//TODO: replace this button with the app button component */}
8086

8187
<ReCAPTCHA
82-
sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY!}
83-
onChange={handleRecaptchaResult}
84-
/>
88+
sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY!}
89+
onChange={handleRecaptchaResult}
90+
/>
8591

86-
{captchaComplete ?
87-
<button
88-
type="submit"
89-
disabled={state.submitting}
90-
className="block rounded-md p-2 my-2 w-[247px] h-14 mx-auto bg-[#EC0505] text-white font-bold font-montserrat"
91-
>
92-
Send Message
93-
</button> :
94-
<button
95-
type="submit"
96-
disabled
97-
className="block rounded-md p-2 my-2 w-[247px] h-14 mx-auto bg-[#EC0505] text-white font-bold font-montserrat"
98-
>
99-
Send Message
100-
</button> }
101-
<ValidationError errors={state.errors} />
92+
{captchaComplete ? (
93+
<button
94+
type="submit"
95+
disabled={state.submitting}
96+
className="block rounded-md p-2 my-2 w-[247px] h-14 mx-auto bg-[#EC0505] text-white font-bold font-montserrat"
97+
>
98+
Send Message
99+
</button>
100+
) : (
101+
<button
102+
type="submit"
103+
disabled
104+
className="block rounded-md p-2 my-2 w-[247px] h-14 mx-auto bg-[#EC0505] text-white font-bold font-montserrat"
105+
>
106+
Send Message
107+
</button>
108+
)}
109+
<ValidationError errors={state.errors} />
102110
</form>
103111
</div>
104112
</>

src/components/ContactUs/MobileVersion.tsx

Lines changed: 50 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
11
/* eslint-disable @typescript-eslint/no-non-null-assertion */
2-
import { useState } from 'react';
2+
import { useState } from 'react';
33
import Image from 'next/image';
44
import mailIcon from '../../../public/img/mail-icon.svg';
55
import messageIcon from '../../../public/img/message-icon.svg';
66

7-
import {useForm, ValidationError} from '@formspree/react';
8-
import ReCAPTCHA from "react-google-recaptcha";
9-
10-
7+
import { useForm, ValidationError } from '@formspree/react';
8+
import ReCAPTCHA from 'react-google-recaptcha';
119

1210
export default function MobileVersion() {
13-
1411
const [captchaComplete, setCaptchaComplete] = useState<boolean>(false);
1512

16-
const [state, handleSubmit] = useForm(process.env.NEXT_PUBLIC_FORMSPREE_ID!);
13+
const [state, handleSubmit] = useForm(process.env.NEXT_PUBLIC_FORMSPREE_ID!);
1714

18-
const handleRecaptchaResult = (result: string | null) => {
19-
if (result) {
20-
setCaptchaComplete(true);
21-
}
22-
}
23-
24-
if (state.succeeded) {
25-
return (
26-
<div className="flex justify-center items-center">
27-
<p className='text-xl font-medium text-green-800'>Thank you for your submission. We will get back to you as soon as possible</p>
28-
</div>
29-
)
15+
const handleRecaptchaResult = (result: string | null) => {
16+
if (result) {
17+
setCaptchaComplete(true);
3018
}
19+
};
3120

21+
if (state.succeeded) {
22+
return (
23+
<div className="flex justify-center items-center">
24+
<p className="text-xl font-medium text-green-800">
25+
Thank you for your submission. We will get back to you as soon as
26+
possible
27+
</p>
28+
</div>
29+
);
30+
}
3231

3332
return (
3433
<>
@@ -42,9 +41,9 @@ export default function MobileVersion() {
4241
>
4342
<input
4443
id="name"
45-
type='text'
46-
name='name'
47-
placeholder='Name'
44+
type="text"
45+
name="name"
46+
placeholder="Name"
4847
className=" placeholder-[#7E7979] outline-none flex-grow ml-8 font-robotoMono text-base"
4948
required
5049
/>
@@ -64,9 +63,9 @@ export default function MobileVersion() {
6463
/>
6564
<input
6665
id="email"
67-
type='email'
68-
placeholder='Email'
69-
name='email'
66+
type="email"
67+
placeholder="Email"
68+
name="email"
7069
className="inline-block ml-2 outline-none flex-grow placeholder-[#7E7979] font-robotoMono text-base"
7170
required
7271
/>
@@ -82,34 +81,40 @@ export default function MobileVersion() {
8281
/>
8382
<textarea
8483
placeholder="Message"
85-
name='message'
84+
name="message"
8685
className=" inline-block ml-2 h-[270px] resize-none outline-none flex-grow placeholder-[#7E7979] font-robotoMono text-base "
8786
required
8887
></textarea>
8988
</label>
90-
<ValidationError prefix="Message" field="message" errors={state.errors} />
89+
<ValidationError
90+
prefix="Message"
91+
field="message"
92+
errors={state.errors}
93+
/>
9194
{/*//TODO: replace this button with the app button component */}
9295

9396
<ReCAPTCHA
94-
sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY!}
95-
onChange={handleRecaptchaResult}
96-
/>
97+
sitekey={process.env.NEXT_PUBLIC_RECAPTCHA_SITE_KEY!}
98+
onChange={handleRecaptchaResult}
99+
/>
97100

98-
{captchaComplete ?
99-
<button
100-
type="submit"
101-
disabled={state.submitting}
102-
className="border-2 border-[#12A04E] w-full rounded-md p-2 my-2 font-montserrat font-bold text-[#12A04E]"
103-
>
104-
Send Message
105-
</button> :
106-
<button
107-
type="submit"
108-
disabled
109-
className="border-2 border-[#12A04E] w-full rounded-md p-2 my-2 font-montserrat font-bold text-[#12A04E]"
110-
>
111-
Send Message
112-
</button> }
101+
{captchaComplete ? (
102+
<button
103+
type="submit"
104+
disabled={state.submitting}
105+
className="border-2 border-[#12A04E] w-full rounded-md p-2 my-2 font-montserrat font-bold text-[#12A04E]"
106+
>
107+
Send Message
108+
</button>
109+
) : (
110+
<button
111+
type="submit"
112+
disabled
113+
className="border-2 border-[#12A04E] w-full rounded-md p-2 my-2 font-montserrat font-bold text-[#12A04E]"
114+
>
115+
Send Message
116+
</button>
117+
)}
113118
<ValidationError errors={state.errors} />
114119
</form>
115120
</>

0 commit comments

Comments
 (0)