summaryrefslogtreecommitdiff
path: root/src/components/header/ProfileOrLogin.tsx
blob: 38c1eb16007d61b3761240232601ea90d36923dc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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>
    );
}