generated from goitacademy/react-homework-template
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from 001elijah/auth
fix auth
- Loading branch information
Showing
15 changed files
with
175 additions
and
89 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { NavLink, useParams } from 'react-router-dom'; | ||
import clsx from 'clsx'; | ||
|
||
import { Login } from 'components/AuthForm/Login/Login'; | ||
import { Register } from 'components/AuthForm/Register/Register'; | ||
|
||
import s from './AuthWindows.module.scss'; | ||
|
||
export const AuthWindows = () => { | ||
const { id } = useParams(); | ||
|
||
return ( | ||
<section className={s.wrap}> | ||
<ul className={s.list}> | ||
<li> | ||
<NavLink | ||
to="/auth/register" | ||
className={({ isActive }) => clsx(s.link, isActive && s.active)} | ||
> | ||
Registration | ||
</NavLink> | ||
</li> | ||
<li> | ||
<NavLink | ||
to="/auth/login" | ||
className={({ isActive }) => clsx(s.link, isActive && s.active)} | ||
> | ||
Log In | ||
</NavLink> | ||
</li> | ||
</ul> | ||
<div className={s.wrapForm}> | ||
{id === 'login' ? <Login /> : <Register />} | ||
</div> | ||
</section> | ||
); | ||
}; |
File renamed without changes.
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,32 @@ | ||
import { useCallback, useEffect } from 'react'; | ||
import { createPortal } from 'react-dom'; | ||
|
||
import s from './BackdropMain.module.scss'; | ||
|
||
const modalRoot = document.querySelector('#modal-root'); | ||
|
||
export const BackdropModal = ({ children, closeModal }) => { | ||
const handleClose = useCallback( | ||
event => { | ||
if (event.target === event.currentTarget || event.code === 'Escape') { | ||
closeModal(); | ||
} | ||
}, | ||
[closeModal], | ||
); | ||
|
||
useEffect(() => { | ||
window.addEventListener('keydown', handleClose); | ||
|
||
return () => { | ||
window.removeEventListener('keydown', handleClose); | ||
}; | ||
}, [handleClose]); | ||
|
||
return createPortal( | ||
<div className={s.backdrop} onClick={handleClose}> | ||
{children} | ||
</div>, | ||
modalRoot, | ||
); | ||
}; |
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 @@ | ||
.backdrop { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
width: 100vw; | ||
height: 100vh; | ||
|
||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
|
||
background-color: rgba(0, 0, 0, 0.8); | ||
z-index: 500; | ||
} |
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,29 @@ | ||
import { NavLink } from 'react-router-dom'; | ||
|
||
import icons from '../../assets/icons/sprite.svg'; | ||
|
||
import s from './WelcomeWindows.module.scss'; | ||
|
||
export const WelcomeWindows = () => { | ||
return ( | ||
<section className={s.section}> | ||
<div className={s.image}></div> | ||
<div className={s.wrap}> | ||
<svg className={s.icon}> | ||
<use href={`${icons}#icon-welcome`}></use> | ||
</svg> | ||
<h1 className={s.title}>Task Pro</h1> | ||
</div> | ||
<p className={s.text}> | ||
Supercharge your productivity and take control of your tasks with Task | ||
Pro - Don't wait, start achieving your goals now! | ||
</p> | ||
<NavLink to="/auth/register" className={s.link}> | ||
Registration | ||
</NavLink> | ||
<NavLink to="/auth/login" className={s.secondLink}> | ||
Log In | ||
</NavLink> | ||
</section> | ||
); | ||
}; |
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,14 @@ | ||
import { BackdropHome } from 'components/BackdropHome/BackdropHome'; | ||
import { AuthWindows } from 'components/AuthWindows/AuthWindows'; | ||
|
||
const AuthPage = () => { | ||
return ( | ||
<BackdropHome> | ||
<div className="container"> | ||
<AuthWindows /> | ||
</div> | ||
</BackdropHome> | ||
); | ||
}; | ||
|
||
export default AuthPage; |
This file was deleted.
Oops, something went wrong.
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,12 @@ | ||
import { BackdropHome } from 'components/BackdropHome/BackdropHome'; | ||
import { WelcomeWindows } from 'components/WelcomeWindows/WelcomeWindows'; | ||
|
||
const WelcomePage = () => { | ||
return ( | ||
<BackdropHome> | ||
<WelcomeWindows /> | ||
</BackdropHome> | ||
); | ||
}; | ||
|
||
export default WelcomePage; |
This file was deleted.
Oops, something went wrong.
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