-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'Feat#1493-navbar-split' of https://github.com/42organiz…
…ation/42gg.client into Style/#1504-responsive-css
- Loading branch information
Showing
15 changed files
with
270 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,47 @@ | ||
import Link from 'next/link'; | ||
import { useRouter } from 'next/router'; | ||
import { createContext, Dispatch, SetStateAction, useState } from 'react'; | ||
import { FiMenu } from 'react-icons/fi'; | ||
import Logo from 'public/image/main-logo.svg'; | ||
import styles from 'styles/agenda/Layout/Header.module.scss'; | ||
import MenuBar from './MenuBar'; | ||
|
||
export interface HeaderContextState { | ||
openMenuState: boolean; | ||
setOpenMenuBarState: Dispatch<SetStateAction<boolean>>; | ||
resetOpenMenuBarState: () => void; | ||
} | ||
|
||
export const HeaderContext = createContext<HeaderContextState | null>(null); | ||
|
||
export default function AgendaHeader() { | ||
const [menu, setMenu] = useState<boolean>(false); | ||
const resetMenuHandler = () => { | ||
setMenu(false); | ||
}; | ||
|
||
const HeaderState: HeaderContextState = { | ||
openMenuState: menu, | ||
setOpenMenuBarState: setMenu, | ||
resetOpenMenuBarState: resetMenuHandler, | ||
}; | ||
|
||
return ( | ||
<div className={styles.headerContainer}> | ||
<div className={styles.headerWrap}> | ||
<div className={styles.headerLeft}> | ||
<FiMenu className={styles.menuIcon} /> | ||
<Link className={styles.logoWrap} href={'/agenda'}> | ||
42AGENDA | ||
</Link> | ||
<HeaderContext.Provider value={HeaderState}> | ||
<div className={styles.headerContainer}> | ||
<div className={styles.headerWrap}> | ||
<div className={styles.headerLeft}> | ||
<Link href='/' onClick={HeaderState.resetOpenMenuBarState}> | ||
<Logo className={styles.logo} /> | ||
</Link> | ||
</div> | ||
<FiMenu | ||
className={styles.menuIcon} | ||
onClick={() => HeaderState?.setOpenMenuBarState(!menu)} | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<MenuBar isActive={HeaderState.openMenuState} /> | ||
</HeaderContext.Provider> | ||
); | ||
} |
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,40 @@ | ||
import { useUser } from 'hooks/agenda/Layout/useUser'; | ||
import styles from 'styles/agenda/Layout/MenuBar.module.scss'; | ||
import MenuBarContent from './MenuBarContent'; | ||
|
||
const MenuBar = ({ isActive }: { isActive: boolean }) => { | ||
const user = useUser(); | ||
|
||
return ( | ||
<> | ||
<div | ||
className={`${styles.container} ${ | ||
isActive ? styles.active : styles.inactive | ||
}`} | ||
> | ||
<MenuBarContent | ||
content={`Hello. ${user?.intraId}`} | ||
href='/agenda/profile' | ||
as='h2' | ||
/> | ||
<MenuBarContent content='Agenda' href='/agenda' as='h1' /> | ||
<div className={styles.divider} /> | ||
<MenuBarContent content='진행중인 대회' href='/agenda' /> | ||
<MenuBarContent content='티켓 확인하기' href='/agenda/ticket' /> | ||
{user?.isAdmin && ( | ||
<> | ||
<MenuBarContent content='admin' href='/agenda/admin' as='h1' /> | ||
</> | ||
)} | ||
</div> | ||
|
||
<div | ||
className={`${styles.bg} ${ | ||
isActive ? styles.activebg : styles.inactivebg | ||
}`} | ||
/> | ||
</> | ||
); | ||
}; | ||
|
||
export default MenuBar; |
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,32 @@ | ||
import Link from 'next/link'; | ||
import { ElementType, useContext } from 'react'; | ||
import styles from 'styles/agenda/Layout/MenuBar.module.scss'; | ||
import { HeaderContext, HeaderContextState } from './AgendaHeader'; | ||
|
||
interface MenuBarContentProps { | ||
as?: ElementType; | ||
content: string; | ||
href: string; | ||
} | ||
|
||
const MenuBarContent = ({ as, content, href }: MenuBarContentProps) => { | ||
const Elem = as || 'p'; | ||
const closeMenuBar = | ||
useContext<HeaderContextState | null>(HeaderContext) | ||
?.resetOpenMenuBarState || | ||
function () { | ||
console.log('resetOpenMenuBarState is not defined'); | ||
}; | ||
|
||
return ( | ||
<div className={styles.content}> | ||
<Link href={href} onClick={closeMenuBar}> | ||
<button className={styles.button}> | ||
<Elem>{content}</Elem> | ||
</button> | ||
</Link> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MenuBarContent; |
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
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,13 +1,18 @@ | ||
@import 'styles/agenda/common.scss'; | ||
.background { | ||
position: relative; | ||
position: fixed; | ||
z-index: -1; | ||
display: flex; | ||
width: 100vw; | ||
min-width: 380px; | ||
min-height: 100vh; | ||
height: calc(100vh - 4rem); | ||
flex-direction: column; | ||
background: var(--color-bg); | ||
background-attachment: fixed; | ||
background-position: center; | ||
background-size: cover; | ||
} | ||
|
||
.container { | ||
margin-top: 4rem; | ||
} |
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,79 @@ | ||
@import 'styles/agenda/common.scss'; | ||
.container { | ||
position: fixed; | ||
z-index: 1999; | ||
width: 25vw; | ||
min-width: 200px; | ||
height: 100vh; | ||
padding: 1rem; | ||
background: var(--menubar-bg); | ||
} | ||
.inactive { | ||
right: calc(max(25vw, 200px) * -1); | ||
box-shadow: none; | ||
transition: all 0.5s; | ||
} | ||
.active { | ||
right: 0; | ||
box-shadow: -1px 0 6px 0 var(--color-text); | ||
transition: all 0.5s; | ||
} | ||
|
||
.inactivebg { | ||
right: 100vw; | ||
transition: all 0.5s; | ||
} | ||
.activebg { | ||
right: 0; | ||
transition: all 0.5s; | ||
} | ||
|
||
.bg { | ||
position: fixed; | ||
z-index: 1998; | ||
width: 100vw; | ||
height: 100vh; | ||
background: var(--box-bg-3); | ||
box-shadow: 5px 0 20px 10px var(--box-bg-3); | ||
opacity: 0.5; | ||
} | ||
.button { | ||
display: flex; | ||
width: 100%; | ||
padding: none; | ||
margin: none; | ||
background: none; | ||
border: none; | ||
justify-content: flex-start; | ||
align-items: center; | ||
} | ||
|
||
.content { | ||
margin: 0; | ||
p { | ||
@include text(description); | ||
} | ||
h1 { | ||
@include text(sub-menu); | ||
padding-top: 0.5rem; | ||
padding-bottom: 0.2rem; | ||
font-size: $font-size-m; | ||
} | ||
h2 { | ||
margin-bottom: 1rem; | ||
font-size: $font-size-s; | ||
color: var(--color-text); | ||
} | ||
p, | ||
h1, | ||
h2 { | ||
@include hoverAction; | ||
} | ||
} | ||
|
||
.divider { | ||
width: 100%; | ||
height: 1px; | ||
margin: 0.5rem 0; | ||
border-bottom: var(--default-border); | ||
} |
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.