-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added loading screen and loading spinner; added rounded corners on ca…
…rousel indicators; GDPR is now required; adjusted prettier configs
- Loading branch information
Showing
13 changed files
with
161 additions
and
332 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,29 +1,41 @@ | ||
import Image from 'next/image'; | ||
import React, { useCallback } from 'react'; | ||
import React, { useCallback, useState } from 'react'; | ||
import ContactFormInterface from '../../interfaces/ContactFormInterface'; | ||
import { sendMessage } from '../../services/contact'; | ||
import Contact from '../forms/contact/ContactForm'; | ||
import LoadingScreen from '../loading-screen'; | ||
import LoadingSpinner from '../loading-spinner'; | ||
import { ModalService } from '../modal/service'; | ||
|
||
const ContactSection = () => { | ||
const [submitting, setSubmitting] = useState(false); | ||
const onFormSubmit = useCallback((data: ContactFormInterface, recaptchaToken: string | undefined) => { | ||
setSubmitting(true); | ||
sendMessage({ ...data, token: recaptchaToken }) | ||
.then(() => { | ||
ModalService.success({ | ||
title: 'Message sent', | ||
description: 'Your message has been sent. You will receive the reply in your email shortly.', | ||
description: 'Your message has been sent. You will receive the reply in your email shortly.' | ||
}); | ||
}) | ||
.catch((error) => { | ||
ModalService.error({ | ||
title: 'Error', | ||
description: error.response.data.message, | ||
description: | ||
error.response?.data?.message || 'Connection error. Please try again later or email us at [email protected]' | ||
}); | ||
}); | ||
}) | ||
.finally(() => setSubmitting(false)); | ||
}, []); | ||
|
||
return ( | ||
<section className='section'> | ||
{submitting && ( | ||
<LoadingScreen> | ||
<LoadingSpinner /> | ||
</LoadingScreen> | ||
)} | ||
|
||
<h1> | ||
<span>Contact us</span> | ||
</h1> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import styles from './loading-screen.module.scss'; | ||
|
||
interface Props { | ||
children: JSX.Element; | ||
} | ||
|
||
const LoadingScreen = ({ children }: Props) => { | ||
return ( | ||
<div className={styles.loading}> | ||
<div>{children}</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoadingScreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
.loading { | ||
@apply fixed left-0 top-0 z-50 h-full w-full overflow-auto bg-black bg-opacity-40 flex justify-center items-center; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import React from 'react'; | ||
import styles from './loading-spinner.module.scss'; | ||
|
||
const LoadingSpinner = () => { | ||
return ( | ||
<div className={styles.loading__spinner}> | ||
<div className={styles.loading}> | ||
<div></div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default LoadingSpinner; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* generated by https://loading.io/ */ | ||
|
||
@keyframes loading { | ||
0% { | ||
transform: translate(-50%, -50%) rotate(0deg); | ||
} | ||
100% { | ||
transform: translate(-50%, -50%) rotate(360deg); | ||
} | ||
} | ||
|
||
.loading { | ||
width: 100%; | ||
height: 100%; | ||
position: relative; | ||
transform: translateZ(0) scale(1); | ||
backface-visibility: hidden; | ||
transform-origin: 0 0; | ||
|
||
div { | ||
position: absolute; | ||
width: 70px; | ||
height: 70px; | ||
border: 25px solid #286090; | ||
border-top-color: transparent; | ||
border-radius: 50%; | ||
|
||
animation: loading 1s linear infinite; | ||
top: 103px; | ||
left: 103px; | ||
|
||
box-sizing: content-box; | ||
} | ||
|
||
&__spinner { | ||
width: 207px; | ||
height: 207px; | ||
display: inline-block; | ||
overflow: hidden; | ||
background: none; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.