Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 51 additions & 1 deletion src/components/NavBar/NavBar.style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,12 +185,32 @@ export const NavBar = styled.div`
.user-name {
color: #171a1f;
font-family: Inter;
font-size: 14px;
font-size: 18px;
font-style: normal;
font-weight: 400;
line-height: 22px; /* 157.143% */
}

.content {
display: flex;
width: 244px;
height: 40px;
justify-content: start;
align-items: center;
gap: 8px;
flex-shrink: 0;
border-radius: 6px;
background: rgba(0, 0, 0, 0);
color: #565d6d;
font-family: Inter;
font-size: 16px;
font-style: bold;
font-weight: 600;
line-height: 22px; /* 157.143% */
margin-left: 18px;
margin-bottom: 5px;
}

/* 작은 화면에서 메뉴가 세로로 나열되도록 */
@media (max-width: 768px) {
.nav-items {
Expand Down Expand Up @@ -218,3 +238,33 @@ export const NavBar = styled.div`
}
}
`;

export const StyledLankLabel = styled.div<{ rank: string }>`
background-color: ${({ rank }) =>
rank === "브론즈"
? "#FFF5F0"
: rank === "실버"
? "#F4F6FB"
: rank === "골드"
? "#FEF9EE"
: "#EFFCFA"};
color: ${({ rank }) =>
rank === "브론즈"
? "#672700"
: rank === "실버"
? "#263F6D"
: rank === "골드"
? "#98690C"
: "#147567"};
border-radius: 18px;
width: 80px;
height: 32px;
font-size: 14px;
text-align: center; /* 텍스트 가운데 정렬 */
display: flex;
justify-content: center;
align-items: center;
margin-top: 16px;
margin-bottom: 10px;
margin-left: 10px;
`;
37 changes: 13 additions & 24 deletions src/components/NavBar/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,20 @@
import { useNavigate, useLocation } from "react-router-dom";
import { useNavigate } from "react-router-dom";
import * as S from "@/components/NavBar/NavBar.style";
import logo from "@/assets/image/logo.svg";
import doc from "@/assets/image/doc.svg";
import lank from "@/assets/image/lank.svg";
import add from "@/assets/image/add.svg";
import myPage from "@/assets/image/myPage.svg";
import logout from "@/assets/image/logout.svg";

const NavBar = () => {
const navigate = useNavigate();
const location = useLocation();

// 특정 경로가 현재 경로와 일치하면 해당 스타일을 적용
const isActive = (path: string) => location.pathname === path;

return (
<S.NavBar>
<div className="left">
<div className="logo">
<img src={logo} alt="Logo" onClick={() => navigate("/main")} />
</div>
<div className="nav-items">
<div
className={isActive("/lank") ? "active" : "nav-item"}
onClick={() => navigate("/lank")}
>
<img src={lank} alt="Lank" />
<a>랭킹 페이지</a>
</div>
<div
className={isActive("/fileask") ? "active" : "nav-item"}
onClick={() => navigate("/fileask")}
>
<img src={doc} alt="Doc" />
<a>문서 요청하기</a>
</div>
</div>
</div>
<div className="right">
<div className="nav-button" onClick={() => navigate("/fileupload")}>
Expand All @@ -60,10 +39,20 @@ const NavBar = () => {
<span className="user-name">사용자 이름</span>
</span>
<hr className="dropdown-hr" />
<S.StyledLankLabel rank="골드">골드</S.StyledLankLabel>
<div className="content">포인트: 1000</div>
<div className="content">누적수익: 1000</div>
<hr className="dropdown-hr" />
<a href="/fileask">
<img src={doc} alt="Doc" />
문서 요청하기
</a>
<a href="/mypage">
<img src={myPage} alt="MyPage" />
마이페이지
<img src={lank} alt="Lank" />
랭킹 페이지
</a>
<hr className="dropdown-hr" />

<a href="/logout">
<img src={logout} alt="logout" />
로그아웃
Expand Down