2023-09-11 00:40:14 -05:00
|
|
|
import { SignedIn, SignedOut, currentUser } from '@clerk/nextjs';
|
2023-09-09 20:05:10 -05:00
|
|
|
import Link from 'next/link';
|
2023-09-11 17:39:02 -05:00
|
|
|
import { BiPlus, BiSolidMessageSquare } from 'react-icons/bi';
|
2023-09-09 21:39:08 -05:00
|
|
|
import ThemeButton from './ThemeButton';
|
2023-09-11 00:40:14 -05:00
|
|
|
import UserButton from './UserButton';
|
2023-09-09 20:05:10 -05:00
|
|
|
|
2023-09-10 20:37:07 -05:00
|
|
|
export default async function Navbar() {
|
|
|
|
|
const user = await currentUser();
|
|
|
|
|
|
2023-09-09 20:05:10 -05:00
|
|
|
return (
|
2023-09-09 21:39:08 -05:00
|
|
|
<nav className='flex items-center justify-between p-5 shadow-md dark:bg-secondary-gray'>
|
2023-09-09 20:10:35 -05:00
|
|
|
<ul className='flex items-center gap-4'>
|
|
|
|
|
<li>
|
2023-09-09 21:39:08 -05:00
|
|
|
<Link
|
|
|
|
|
href='/'
|
|
|
|
|
className='italic'
|
|
|
|
|
>
|
2023-09-09 20:36:47 -05:00
|
|
|
conve
|
2023-09-09 21:39:08 -05:00
|
|
|
<span className='font-bold text-4xl text-primary-accent'>X</span>
|
2023-09-09 20:36:47 -05:00
|
|
|
</Link>
|
2023-09-09 20:10:35 -05:00
|
|
|
</li>
|
2023-09-09 23:53:20 -05:00
|
|
|
<SignedIn>
|
|
|
|
|
<li>
|
|
|
|
|
{/* TODO: Style this */}
|
|
|
|
|
<div>
|
|
|
|
|
<input
|
|
|
|
|
type='text'
|
|
|
|
|
placeholder='Search'
|
|
|
|
|
/>
|
|
|
|
|
</div>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Link href='#'>Following</Link>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
2023-09-10 20:37:07 -05:00
|
|
|
<Link href={`/profile/${user?.id}`}>Profile</Link>
|
2023-09-09 23:53:20 -05:00
|
|
|
</li>
|
|
|
|
|
<li>
|
2023-09-11 17:39:02 -05:00
|
|
|
<div className='mx-4'>
|
|
|
|
|
<Link
|
|
|
|
|
href='/posts/add'
|
|
|
|
|
className='relative'
|
|
|
|
|
>
|
|
|
|
|
<BiSolidMessageSquare className='absolute w-10 h-10 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-primary-accent' />
|
|
|
|
|
<BiPlus className='absolute w-5 h-5 top-1/2 left-1/2 transform -translate-x-1/2 -translate-y-1/2 text-white' />
|
|
|
|
|
</Link>
|
|
|
|
|
</div>
|
2023-09-09 23:53:20 -05:00
|
|
|
</li>
|
|
|
|
|
</SignedIn>
|
2023-09-09 20:10:35 -05:00
|
|
|
</ul>
|
2023-09-09 20:05:10 -05:00
|
|
|
<ul className='flex items-center gap-4'>
|
2023-09-09 21:39:08 -05:00
|
|
|
<li>
|
|
|
|
|
<ThemeButton />
|
|
|
|
|
</li>
|
2023-09-09 20:05:10 -05:00
|
|
|
<SignedIn>
|
|
|
|
|
<li>
|
2023-09-11 00:40:14 -05:00
|
|
|
<UserButton />
|
2023-09-09 20:05:10 -05:00
|
|
|
</li>
|
|
|
|
|
</SignedIn>
|
|
|
|
|
<SignedOut>
|
|
|
|
|
<li>
|
|
|
|
|
<Link href='/login'>Sign in</Link>
|
|
|
|
|
</li>
|
|
|
|
|
<li>
|
|
|
|
|
<Link href='/signup'>Sign up</Link>
|
|
|
|
|
</li>
|
|
|
|
|
</SignedOut>
|
|
|
|
|
</ul>
|
|
|
|
|
</nav>
|
|
|
|
|
);
|
|
|
|
|
}
|