File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import { Link , NavLink } from "react-router-dom" ;
1+ import { Link , NavLink , useLocation } from "react-router-dom" ;
22
33import pandaLogo from "@/assets/logo.png" ;
44import UserIcon from "@/assets/ic_user.svg" ;
55import { HeaderStyle } from "@/components/layout/Header.style" ;
66import { WidthContainer } from "@/styles/commonStyle" ;
77
88function Header ( ) {
9+ const { pathname } = useLocation ( ) ;
10+
11+ const itemsActive = pathname . startsWith ( "/items" ) || pathname === "/additem" ;
912 return (
1013 < HeaderStyle >
1114 < WidthContainer >
@@ -27,7 +30,9 @@ function Header() {
2730 < li >
2831 < NavLink
2932 to = "/items"
30- className = { ( { isActive } ) => ( isActive ? "active" : "" ) }
33+ className = { ( { isActive } ) =>
34+ isActive || itemsActive ? "active" : ""
35+ }
3136 >
3237 중고마켓
3338 </ NavLink >
Original file line number Diff line number Diff line change @@ -66,6 +66,7 @@ export const HeaderStyle = styled.header`
6666 text-decoration: underline;
6767 text-underline-offset: 4px;
6868 text-decoration-thickness: 2px;
69+ color: var(--primary-100);
6970 }
7071
7172 .user_img {
You can’t perform that action at this time.
0 commit comments