-
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.
Merge pull request #31 from DguFarmSystem/fix/25-fix-header-and-union…
…-section Fix/25 fix header and union section
- Loading branch information
Showing
9 changed files
with
239 additions
and
57 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,52 @@ | ||
import styled from 'styled-components'; | ||
|
||
export const MobileNavbar = styled.div<{ isNavOpen: boolean }>` | ||
max-height: ${({ isNavOpen }) => (isNavOpen ? "300px" : "80px")}; | ||
overflow: hidden; | ||
transition: max-height 0.1s ease-in-out; | ||
display: inline-flex; | ||
height: auto; | ||
padding: 10px 10px; | ||
flex-direction: column; | ||
justify-content: center; | ||
align-items: center; | ||
width: 150px; | ||
border-radius: 20px 0px 20px 20px; | ||
border: 1px solid var(--FarmSystem_White, #FCFCFC); | ||
background: var(--FarmSystem_Green01, #28723F); | ||
`; | ||
|
||
export const MobileNavItem = styled.a` | ||
display: flex; | ||
padding: 5px 0px; | ||
align-items: center; | ||
gap: 3px; | ||
flex: 1 0 0; | ||
`; | ||
|
||
export const MobileNavText = styled.p` | ||
color: var(--FarmSystem_White, #FCFCFC); | ||
text-align: center; | ||
font-size: 14px; | ||
font-style: normal; | ||
font-weight: 500; | ||
line-height: 16px; | ||
letter-spacing: -0.24px; | ||
`; | ||
|
||
/* 확장/축소 버튼 스타일 */ | ||
export const ExpandButton = styled.button` | ||
color: var(--FarmSystem_White, #FCFCFC); | ||
font-size: 24px; | ||
cursor: pointer; | ||
width: 80%; | ||
background-color: rgba(0, 0, 0, 0.5); | ||
border-radius: 15px; | ||
display: flex; | ||
justify-content: center; | ||
align-items: center; | ||
`; |
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,74 @@ | ||
import { useState } from 'react'; | ||
import * as S from './MobileNav.styled'; | ||
import { IoMdArrowDropdown, IoMdArrowDropup } from "react-icons/io"; | ||
|
||
interface MobileNavProps { | ||
currentSection: string; | ||
handleSmoothScroll: ( | ||
event: React.MouseEvent<HTMLAnchorElement, MouseEvent>, | ||
targetId: string | ||
) => void; | ||
} | ||
|
||
const navItems = [ | ||
{ id: "about", text: "Farm System이란?" }, | ||
{ id: "tracks", text: "트랙 및 커리큘럼" }, | ||
{ id: "achievements", text: "활동 및 성과" }, | ||
{ id: "eligibility", text: "지원 요건" }, | ||
]; | ||
|
||
export default function MobileNav({ currentSection, handleSmoothScroll }: MobileNavProps) { | ||
const [isNavOpen, setIsNavOpen] = useState(false); | ||
const currentNavItem = navItems.find(item => item.id === currentSection) ?? navItems[0]; | ||
|
||
return ( | ||
<S.MobileNavbar isNavOpen={isNavOpen}> | ||
{/* | ||
isNavOpen이 false면 첫 번째 메뉴만 보이게, | ||
true면 모든 메뉴가 보이게 설정 | ||
*/} | ||
{!isNavOpen && ( | ||
<S.MobileNavItem | ||
href={"#" + currentNavItem.id} | ||
onClick={(e) => handleSmoothScroll(e, currentNavItem.id)} | ||
> | ||
<S.MobileNavText>{currentNavItem.text}</S.MobileNavText> | ||
</S.MobileNavItem> | ||
)} | ||
|
||
{isNavOpen && ( | ||
<> | ||
<S.MobileNavItem | ||
href="#about" | ||
onClick={(e) => handleSmoothScroll(e, "#about")} | ||
> | ||
<S.MobileNavText>Farm System이란?</S.MobileNavText> | ||
</S.MobileNavItem> | ||
<S.MobileNavItem | ||
href="#tracks" | ||
onClick={(e) => handleSmoothScroll(e, "#tracks")} | ||
> | ||
<S.MobileNavText>트랙 및 커리큘럼</S.MobileNavText> | ||
</S.MobileNavItem> | ||
<S.MobileNavItem | ||
href="#achievements" | ||
onClick={(e) => handleSmoothScroll(e, "#achievements")} | ||
> | ||
<S.MobileNavText>활동 및 성과</S.MobileNavText> | ||
</S.MobileNavItem> | ||
<S.MobileNavItem | ||
href="#eligibility" | ||
onClick={(e) => handleSmoothScroll(e, "#eligibility")} | ||
> | ||
<S.MobileNavText>지원 요건</S.MobileNavText> | ||
</S.MobileNavItem> | ||
</> | ||
)} | ||
|
||
{/* 확장/축소 버튼 */} | ||
<S.ExpandButton onClick={() => setIsNavOpen((prev) => !prev)}> | ||
{isNavOpen ? <IoMdArrowDropup /> : <IoMdArrowDropdown />} | ||
</S.ExpandButton> | ||
</S.MobileNavbar> | ||
); | ||
} |
Oops, something went wrong.