diff options
Diffstat (limited to 'src/components/header/ProfileOrLogin.tsx')
| -rw-r--r-- | src/components/header/ProfileOrLogin.tsx | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/components/header/ProfileOrLogin.tsx b/src/components/header/ProfileOrLogin.tsx new file mode 100644 index 0000000..38c1eb1 --- /dev/null +++ b/src/components/header/ProfileOrLogin.tsx @@ -0,0 +1,25 @@ +'use client'; + +import Image from 'next/image'; +import { useUser } from '../../lib/contexts'; +import { Button } from '../ui'; +import Link from 'next/link'; + +export function ProfileOrLogin() { + const user = useUser(); + + if (!user) { + return <Button className="py-2.5 px-3.75">ВОЙТИ</Button>; + } + + return ( + <Link href={'/profile'}> + <Image + src={user?.avatar ?? 'icons/avatar.svg'} + alt="" + width={60} + height={60} + /> + </Link> + ); +} |
