-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This reverts commit 55a6b98.
- Loading branch information
Showing
4 changed files
with
56 additions
and
146 deletions.
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
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,53 +1,40 @@ | ||
import { PropsWithChildren, ReactNode } from 'react'; | ||
|
||
interface TopNavigationProps { | ||
children?: ReactNode; | ||
import { IconArrowLeft, IconHamburger } from '@public/icons'; | ||
import Link from 'next/link'; | ||
import { PropsWithChildren } from 'react'; | ||
|
||
interface Props extends PropsWithChildren { | ||
titleAlign?: 'center' | 'left'; | ||
title?: string; | ||
isOwner?: boolean; | ||
} | ||
|
||
type ItemProps = TopNavigationProps; | ||
|
||
const TopNavigation = ({ children }: TopNavigationProps) => { | ||
const TopNavigation = ({ | ||
children, | ||
titleAlign = 'center', | ||
title = '', | ||
isOwner = false, | ||
}: Props) => { | ||
return ( | ||
<div className="relative flex h-[2.4rem] w-full items-center justify-center bg-opacity-0 px-[2rem] py-[1.7rem] text-md"> | ||
{children} | ||
<div className="relative flex h-[5.4rem] w-full gap-[1.5rem] bg-opacity-0 px-[2rem] py-[1.7rem]"> | ||
<Link href="."> | ||
<IconArrowLeft className="hover:cursor-pointer" /> | ||
</Link> | ||
<div | ||
className={`flex w-full pr-[3.5rem] text-md font-normal leading-[1.9rem] ${TITLE_ALIGN_CLASSES[titleAlign]}`} | ||
> | ||
{title} | ||
</div> | ||
<div className="absolute right-[2rem] flex gap-[1rem]"> | ||
{children} | ||
{isOwner && <IconHamburger className="hover:cursor-pointer" />} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
const LeftItem = ({ children }: ItemProps) => { | ||
return ( | ||
<div className="absolute left-[2rem] [&_svg]:h-[2rem] [&_svg]:w-[2rem] [&_svg]:cursor-pointer"> | ||
{children} | ||
</div> | ||
); | ||
}; | ||
|
||
type CenterItemProps = PropsWithChildren<{ textAlign?: 'left' | 'center' }>; | ||
|
||
const textAligns = { | ||
left: 'text-left', | ||
center: 'text-center', | ||
} as const; | ||
|
||
const CenterItem = ({ children, textAlign = 'center' }: CenterItemProps) => { | ||
const alignClassName = textAligns[textAlign]; | ||
return ( | ||
<div className={`w-full px-[3.5rem] ${alignClassName}`}>{children}</div> | ||
); | ||
}; | ||
export default TopNavigation; | ||
|
||
const RightItem = ({ children }: ItemProps) => { | ||
return ( | ||
<div className="absolute right-[2rem] flex gap-[1rem] [&_svg]:h-[2rem] [&_svg]:w-[2rem] [&_svg]:cursor-pointer"> | ||
{children} | ||
</div> | ||
); | ||
const TITLE_ALIGN_CLASSES = { | ||
center: 'justify-center', | ||
left: 'justify-start', | ||
}; | ||
|
||
TopNavigation.LeftItem = LeftItem; | ||
|
||
TopNavigation.CenterItem = CenterItem; | ||
|
||
TopNavigation.RightItem = RightItem; | ||
|
||
export default TopNavigation; |