-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add logout feature + fix layout
- Loading branch information
1 parent
e713ac9
commit 3fc887b
Showing
13 changed files
with
192 additions
and
54 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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,16 +1,7 @@ | ||
import { HTMLAttributes } from 'react' | ||
import { twMerge } from 'tailwind-merge' | ||
|
||
const PageContainer = (props: HTMLAttributes<HTMLDivElement>) => { | ||
return ( | ||
<div className="flex min-h-[calc(100dvh-3rem)] w-full items-center justify-center py-6 *:w-full md:*:w-2/5"> | ||
<div | ||
className={twMerge('mx-auto flex h-full w-full items-center justify-evenly *:w-full', props.className)} | ||
> | ||
{props.children} | ||
</div> | ||
</div> | ||
) | ||
return <div className="flex w-full items-center justify-center *:w-full md:*:w-2/5">{props.children}</div> | ||
} | ||
|
||
export default PageContainer |
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,35 @@ | ||
'use client' | ||
import { LOGOUT_ICON } from '@/assets' | ||
import { Button } from '@/components/0_Bruddle' | ||
import { useAuth } from '@/context/authContext' | ||
import { getHeaderTitle } from '@/utils' | ||
import Image from 'next/image' | ||
import { usePathname } from 'next/navigation' | ||
import Loading from '../Loading' | ||
|
||
const TopNavbar = () => { | ||
const { logoutUser, isLoggingOut } = useAuth() | ||
const pathname = usePathname() | ||
|
||
const logout = async () => { | ||
await logoutUser() | ||
} | ||
|
||
return ( | ||
<div className="hidden h-[72px] items-center justify-between border-b border-b-black bg-background px-6 md:flex"> | ||
<h1 className="text-2xl font-extrabold md:ml-64">{getHeaderTitle(pathname)}</h1> | ||
<Button | ||
disabled={isLoggingOut} | ||
size="medium" | ||
variant="transparent-dark" | ||
onClick={logout} | ||
className="flex w-fit items-center gap-3 hover:text-gray-1" | ||
> | ||
{isLoggingOut ? <Loading /> : <Image src={LOGOUT_ICON} alt="Logout" width={24} height={24} />} | ||
{isLoggingOut ? 'Logging out...' : 'Logout'} | ||
</Button> | ||
</div> | ||
) | ||
} | ||
|
||
export default TopNavbar |
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
Oops, something went wrong.