-
Notifications
You must be signed in to change notification settings - Fork 2
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
…efactoring Feature/fe/#301 header refactoring
- Loading branch information
Showing
15 changed files
with
239 additions
and
130 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import { ReactNode } from 'react'; | ||
import classNames from 'classnames'; | ||
|
||
interface IHeaderProps { | ||
leftItems?: ReactNode[]; | ||
rightItems?: ReactNode[]; | ||
title?: ReactNode; | ||
subtitle?: string; | ||
className?: string; | ||
userName?: string; | ||
} | ||
|
||
export const HeaderLayout = (props: IHeaderProps) => { | ||
return ( | ||
<header | ||
className={classNames( | ||
'absolute flex w-full flex-col gap-2.5 bg-transparent px-4 pb-2 pt-4', | ||
props.className, | ||
)} | ||
> | ||
<div className="flex items-center justify-between"> | ||
<div className="flex items-center gap-1"> | ||
{props.leftItems && | ||
props.leftItems.map(item => ( | ||
<div className="flex items-center justify-center">{item}</div> | ||
))} | ||
<div className="flex items-center justify-center text-base"> | ||
<div className="font-bold">{props.userName}</div> | ||
<div>{props.title}</div> | ||
</div> | ||
</div> | ||
<div className="flex items-center gap-1"> | ||
{props.rightItems && | ||
props.rightItems.map(item => ( | ||
<div className="flex items-center justify-center">{item}</div> | ||
))} | ||
</div> | ||
</div> | ||
<div className="text-grayscale-400 ml-8 text-xs">{props.subtitle}</div> | ||
</header> | ||
); | ||
}; |
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,25 +1,19 @@ | ||
import { Header } from '@/component/header/Header'; | ||
import { NoticeText } from '@/component/text/NoticeText'; | ||
import { useLocation, useParams } from 'react-router-dom'; | ||
import { getHeaderInfo } from '@/utils/mapping/HeaderMapping'; | ||
import { HeaderLayout } from '@/component/header/HeaderLayout'; | ||
|
||
export const LayoutHeader = () => { | ||
const params = useParams<Record<string, string | undefined>>(); | ||
const urlPath = useLocation(); | ||
const headerOption = getHeaderInfo(urlPath.pathname); | ||
|
||
return ( | ||
<Header className="z-4000"> | ||
<Header.MainLayout | ||
leftButton={headerOption.leftButton} | ||
rightButton={headerOption.rightButton} | ||
title={`${params.user || ''}${headerOption.title}`} | ||
/> | ||
{headerOption.subtitle && ( | ||
<Header.Subtitle> | ||
<NoticeText>{headerOption.subtitle}</NoticeText> | ||
</Header.Subtitle> | ||
)} | ||
</Header> | ||
<HeaderLayout | ||
className="z-[5000]" | ||
userName={`${params.user || ''}`} | ||
title={`${headerOption.title}`} | ||
subtitle={`${headerOption.subtitle}`} | ||
leftItems={headerOption.leftItems} | ||
rightItems={headerOption.rightItems} | ||
/> | ||
); | ||
}; |
Oops, something went wrong.