generated from ita-social-projects/DevTemplate
-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
#216 add modal window email varify #262
Merged
Merged
Changes from 10 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
1a341e8
Create a page with info about sending email activation
whooaami 39bd173
Fix style for email activation page
whooaami beac3af
Create a page for resend email activation
whooaami ad58f4d
Add button cancel for modal page
whooaami 334e316
Create modal for email activation
whooaami 805e047
Merge branch 'develop' into #216-AddModalWindowEmailVarify
whooaami e343f6a
Fix by linter
whooaami 0c48092
Fix by linter
whooaami 5e17301
Fix
whooaami c991cc2
Fixed
whooaami 2538568
Merge branch 'develop' into #216-AddModalWindowEmailVarify
whooaami fe1beef
Add toast alert for error
whooaami 818afe8
Add import for prop-types
whooaami File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
FrontEnd/src/components/SignUp/components/signup/ResendActivationForm.js
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,47 @@ | ||
import styles from './ResendActivationForm.module.css'; | ||
import { ResendActivationFormContentComponent } from './signup-form/ResendActivationFormContent'; | ||
import { useState } from 'react'; | ||
import { Link } from 'react-router-dom'; | ||
|
||
export function ResendActivationFormComponent() { | ||
const [isValid, setIsValid] = useState(false); | ||
|
||
const updateIsValid = (value) => { | ||
setIsValid(value); | ||
}; | ||
return ( | ||
<div className={styles['form__container']}> | ||
<div className={styles['form__header']}> | ||
Надіслати лист для активації ще раз | ||
</div> | ||
<div className={styles['form__footer']}> | ||
<p> | ||
Введіть електронну адресу вказану при реєстрації для повторного | ||
надіслення листа. <br /> | ||
На зазначену Вами електронну пошту буде відправлено листа з посиланням | ||
для активації. <br /> | ||
</p> | ||
</div> | ||
<ResendActivationFormContentComponent setIsValid={updateIsValid} /> | ||
<div className={styles['form__footer']}> | ||
<div className={styles['button-container']}> | ||
<Link className={styles['signup-page__button']} to="/sign-up"> | ||
Скасувати | ||
</Link> | ||
<button | ||
disabled={!isValid} | ||
form="signUpForm" | ||
className={ | ||
isValid | ||
? styles['resend-activation__button'] | ||
: styles['resend-activation__button__disabled'] | ||
} | ||
type="submit" | ||
> | ||
Надіслати | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
} |
132 changes: 132 additions & 0 deletions
132
FrontEnd/src/components/SignUp/components/signup/ResendActivationForm.module.css
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,132 @@ | ||
.form__container { | ||
display: flex; | ||
width: 572px; | ||
flex-direction: column; | ||
align-items: flex-start; | ||
|
||
border-radius: 2px; | ||
background: var(--conditional-pop-over, #fff); | ||
|
||
/* drop-shadow/0.12+0.8+0.5 */ | ||
box-shadow: 0px 9px 28px 8px rgba(0, 0, 0, 0.05), | ||
0px 6px 16px 0px rgba(0, 0, 0, 0.08), 0px 3px 6px -4px rgba(0, 0, 0, 0.12); | ||
} | ||
|
||
.form__header { | ||
display: flex; | ||
padding: 16px 24px; | ||
align-items: flex-start; | ||
gap: 36px; | ||
align-self: stretch; | ||
background: var(--main-white, #fff); | ||
|
||
/* border & divider/divider ↓ */ | ||
box-shadow: 0px -1px 0px 0px #f0f0f0 inset; | ||
color: var(--character-title-85, rgba(0, 0, 0, 0.85)); | ||
font-feature-settings: "calt" off; | ||
|
||
/* Text/Body/16-Semi bold */ | ||
font-family: Inter, sans-serif; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 20px; | ||
/* 125% */ | ||
letter-spacing: -0.16px; | ||
} | ||
|
||
.form__footer { | ||
display: flex; | ||
padding: 16px 24px; | ||
justify-content: flex-end; | ||
align-items: center; | ||
gap: 8px; | ||
align-self: stretch; | ||
background: var(--main-white, #fff); | ||
|
||
/* border & divider/divider ↑ */ | ||
box-shadow: 0px 1px 0px 0px #f0f0f0 inset; | ||
} | ||
|
||
.button-container { | ||
display: flex; | ||
align-items: flex-start; | ||
gap: 12px; | ||
} | ||
|
||
.signup-page__button { | ||
display: flex; | ||
padding: 5px 15px; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 10px; | ||
border-radius: 4px; | ||
border: 1px solid var(--primary-green-80, #1f9a7c); | ||
background: var(--main-white, #fff); | ||
|
||
/* drop-shadow/button-secondary */ | ||
box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.02); | ||
|
||
color: var(--primary-green-80, #1f9a7c); | ||
text-align: center; | ||
font-feature-settings: "calt" off; | ||
|
||
/* Text/Body/16-Semi bold */ | ||
font-family: Inter, sans-serif; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 20px; | ||
/* 125% */ | ||
letter-spacing: -0.16px; | ||
text-decoration: none; | ||
|
||
cursor: pointer; | ||
} | ||
|
||
.signup-page__button:hover { | ||
border: 1px solid var(--primary-green-80, #1f9a7c); | ||
background: var(--primary-green-80, #1f9a7c); | ||
color: var(--main-white, #fff); | ||
} | ||
|
||
.resend-activation__button, | ||
.resend-activation__button__disabled { | ||
display: flex; | ||
padding: 5px 15px; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 10px; | ||
border-radius: 4px; | ||
border: 1px solid var(--primary-green-80, #1f9a7c); | ||
background: var(--primary-green-80, #1f9a7c); | ||
|
||
/* drop-shadow/button-primary */ | ||
box-shadow: 0px 2px 0px 0px rgba(0, 0, 0, 0.04); | ||
color: var(--main-white, #fff); | ||
text-align: center; | ||
font-feature-settings: "calt" off; | ||
|
||
/* Text/Body/16-Semi bold */ | ||
font-family: Inter, sans-serif; | ||
font-size: 16px; | ||
font-style: normal; | ||
font-weight: 600; | ||
line-height: 20px; | ||
/* 125% */ | ||
letter-spacing: -0.16px; | ||
|
||
cursor: pointer; | ||
} | ||
|
||
.resend-activation__button__disabled { | ||
opacity: 50%; | ||
cursor: default; | ||
} | ||
|
||
.resend-activation__button:hover { | ||
border: 1px solid var(--primary-green-80, #1f9a7c); | ||
background: var(--main-white, #fff); | ||
color: var(--primary-green-80, #1f9a7c); | ||
} | ||
|
93 changes: 93 additions & 0 deletions
93
FrontEnd/src/components/SignUp/components/signup/signup-form/ResendActivationFormContent.js
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,93 @@ | ||
import { useEffect } from 'react'; | ||
import { useForm } from 'react-hook-form'; | ||
import { useNavigate } from 'react-router-dom'; | ||
|
||
import axios from 'axios'; | ||
import styles from './ResendActivationFormContent.module.css'; | ||
|
||
export function ResendActivationFormContentComponent({ setIsValid }) { | ||
const navigate = useNavigate(); | ||
|
||
const errorMessageTemplates = { | ||
required: 'Обов’язкове поле', | ||
email: 'Email не відповідає вимогам', | ||
}; | ||
|
||
const emailPattern = /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/i; | ||
|
||
const { | ||
register, | ||
handleSubmit, | ||
getValues, | ||
formState: { errors, isValid }, | ||
} = useForm({ | ||
mode: 'all', | ||
}); | ||
|
||
useEffect(() => { | ||
const formIsValid = isValid; | ||
setIsValid(formIsValid); | ||
}, [isValid, setIsValid]); | ||
|
||
const onSubmit = () => { | ||
const dataToSend = { | ||
email: getValues('email'), | ||
}; | ||
|
||
axios({ | ||
method: 'post', | ||
url: `${process.env.REACT_APP_BASE_API_URL}/api/auth/users/resend_activation/`, | ||
withCredentials: false, | ||
data: dataToSend, | ||
}) | ||
.then(() => { | ||
setIsValid(true); | ||
navigate('/login'); | ||
}) | ||
.catch((error) => console.log(error)); | ||
}; | ||
|
||
return ( | ||
<div className={styles['resend-activation-form']}> | ||
<form | ||
id="signUpForm" | ||
className={styles['resend-activation-form__container']} | ||
onSubmit={handleSubmit(onSubmit)} | ||
autoComplete="off" | ||
noValidate | ||
> | ||
<div className={styles['resend-activation-form__row']}> | ||
<div className={styles['resend-activation-form__column']}> | ||
<div className={styles['resend-activation-form__label']}> | ||
<label | ||
className={styles['resend-activation-form__label--required']} | ||
> | ||
* | ||
</label> | ||
<label className={styles['resend-activation-form__label--text']}> | ||
Електронна пошта | ||
</label> | ||
</div> | ||
<div className={styles['resend-activation-form__field']}> | ||
<input | ||
className={styles['resend-activation-form__input']} | ||
placeholder="Електронна пошта" | ||
type="email" | ||
{...register('email', { | ||
required: errorMessageTemplates.required, | ||
pattern: { | ||
value: emailPattern, | ||
message: errorMessageTemplates.email, | ||
}, | ||
})} | ||
/> | ||
</div> | ||
<div className={styles['resend-activation-form__error']}> | ||
{errors.email && errors.email.message} | ||
</div> | ||
</div> | ||
</div> | ||
</form> | ||
</div> | ||
); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add prop types here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed