-
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.
- Loading branch information
Showing
10 changed files
with
77 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"Войти": "" | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { ReactNode } from 'react'; | ||
import { createPortal } from 'react-dom'; | ||
|
||
interface PortalProps { | ||
children: ReactNode; | ||
element?: HTMLElement; | ||
} | ||
|
||
export const Portal = (props: PortalProps) => { | ||
const { | ||
children, | ||
element = document.body, | ||
} = props; | ||
|
||
return createPortal(children, element); | ||
}; |
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,12 +1,37 @@ | ||
import { classNames } from 'shared/lib/classNames/classNames'; | ||
import { Modal } from 'shared/ui/Modal/Modal'; | ||
import React, { useCallback, useState } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
import { Button, ButtonTheme } from 'shared/ui/Button/Button'; | ||
import cls from './Navbar.module.scss'; | ||
|
||
interface NavbarProps { | ||
className?: string; | ||
} | ||
|
||
export const Navbar = ({ className }: NavbarProps) => ( | ||
<div className={classNames(cls.Navbar, {}, [className])}> | ||
<div className={cls.links} /> | ||
</div> | ||
); | ||
export const Navbar = ({ className }: NavbarProps) => { | ||
const { t } = useTranslation(); | ||
const [isAuthModal, setIsAuthModal] = useState(false); | ||
|
||
const onToggleModal = useCallback(() => { | ||
setIsAuthModal((prev) => !prev); | ||
}, []); | ||
|
||
return ( | ||
<div className={classNames(cls.Navbar, {}, [className])}> | ||
<Button | ||
theme={ButtonTheme.CLEAR_INVERTED} | ||
className={cls.links} | ||
onClick={onToggleModal} | ||
> | ||
{t('Войти')} | ||
</Button> | ||
<Modal isOpen={isAuthModal} onClose={onToggleModal}> | ||
Lorem ipsum dolor sit amet, consectetur adipisicing elit. A ab | ||
accusantium aliquid architecto autem consequuntur debitis et facere, | ||
laudantium modi nostrum nulla obcaecati odit quas quod sapiente, | ||
veritatis? Illo, veritatis. | ||
</Modal> | ||
</div> | ||
); | ||
}; |