Files
conve-x/src/components/Navbar.tsx
T

72 lines
2.0 KiB
TypeScript
Raw Normal View History

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';
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
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>
<Link href={`/profile/${user?.id}`}>Profile</Link>
2023-09-09 23:53:20 -05:00
</li>
<li>
<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>
);
}