-
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 #12 from 9JIIIIIN9/main
로고 변경 및 버튼 수정
- Loading branch information
Showing
13 changed files
with
316 additions
and
44 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
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
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,136 @@ | ||
import React, { useState, useEffect } from "react"; | ||
|
||
import * as S from "./NavBar/styles"; | ||
import styled from "styled-components"; | ||
import { useNavigate } from "react-router-dom"; | ||
import Horizon from "../../components/NavBar/horizon"; | ||
import Logo from "../../assets/newSymbol.svg"; | ||
const ImageWrapper = styled.button` | ||
display: flex; | ||
width: 100%; | ||
//원래 1.69 | ||
margin-right: 2rem; | ||
//원래 2.77rem | ||
margin-left: 2.5rem; | ||
height: 100%; | ||
`; | ||
const Image = styled.img` | ||
display: block; | ||
width: auto; | ||
`; | ||
const Group = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
width: 100%; | ||
margin-right: 1.25rem; | ||
margin-bottom: 7.94rem; | ||
text-align: start; | ||
&:hover { | ||
background-color: #fff; | ||
transition: background-color 0.8s; | ||
} | ||
`; | ||
const NavbarMain = () => { | ||
const navigate = useNavigate(); | ||
const [topOffset, setTopOffset] = useState(0); | ||
const [lastScrollY, setLastScrollY] = useState(0); | ||
|
||
function handleClick() { | ||
console.log("NavMenu가 클릭!"); | ||
navigate("/about"); | ||
} | ||
|
||
//NavBar 효과 | ||
useEffect(() => { | ||
const handleScroll = () => { | ||
const currentScrollY = window.scrollY; | ||
if (currentScrollY === 0) { | ||
// 스크롤 위치가 0이면 고정 | ||
setTopOffset(20); | ||
} else if (currentScrollY > lastScrollY) { | ||
// 스크롤 다운 | ||
setTopOffset(-60); // navBar를 40px 위로 이동 | ||
} else { | ||
// 스크롤 업 | ||
setTopOffset(0); // navBar를 맨 위에 붙이기 | ||
} | ||
setLastScrollY(currentScrollY); | ||
}; | ||
|
||
window.addEventListener("scroll", handleScroll); | ||
|
||
return () => { | ||
window.removeEventListener("scroll", handleScroll); | ||
}; | ||
}, [lastScrollY]); | ||
return ( | ||
<S.NavBar style={{ top: `${topOffset}px`, transition: "top 0.3s" }}> | ||
<ImageWrapper> | ||
<Image | ||
src={Logo} | ||
alt="logo" | ||
onClick={() => { | ||
navigate("/"); | ||
}} | ||
/> | ||
</ImageWrapper> | ||
<Group> | ||
<Horizon /> | ||
|
||
<S.NavMenu | ||
onClick={() => { | ||
navigate("/branding"); | ||
}} | ||
> | ||
Symbol Logic | ||
</S.NavMenu> | ||
</Group> | ||
<Group> | ||
<Horizon /> | ||
<S.NavMenu | ||
onClick={() => { | ||
navigate("/branding"); | ||
}} | ||
> | ||
About | ||
</S.NavMenu> | ||
</Group> | ||
<Group> | ||
<Horizon /> | ||
<S.NavMenu | ||
onClick={() => { | ||
navigate("/business"); | ||
}} | ||
> | ||
Business Model | ||
</S.NavMenu> | ||
</Group> | ||
<Group> | ||
<Horizon /> | ||
<S.NavMenu | ||
onClick={() => { | ||
navigate("/contact"); | ||
}} | ||
> | ||
Contact | ||
</S.NavMenu> | ||
</Group> | ||
<Group> | ||
<Horizon /> | ||
<S.NavMenu onClick={handleClick}>Shop</S.NavMenu> | ||
</Group> | ||
<Group> | ||
<Horizon /> | ||
<S.NavMenu | ||
onClick={handleClick} | ||
style={{ fontSize: "1.12rem" }} | ||
hoverColor="#5339FD" | ||
> | ||
Model Graphic {">"}{" "} | ||
</S.NavMenu> | ||
</Group> | ||
</S.NavBar> | ||
); | ||
}; | ||
|
||
export default NavbarMain; |
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.