-
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.
π fix: pR 리뷰 λ°μ μ½λ μμ
- Loading branch information
1 parent
549d4e0
commit c676c16
Showing
3 changed files
with
29 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"use client"; | ||
|
||
import * as NM from "@radix-ui/react-navigation-menu"; | ||
import NextLink, { LinkProps } from "next/link"; | ||
import { usePathname } from "next/navigation"; | ||
|
||
const NavLink = ({ | ||
href, | ||
...props | ||
}: LinkProps & { children: React.ReactNode }) => { | ||
const pathname = usePathname(); | ||
const isActive = href === pathname; | ||
|
||
return ( | ||
<NM.Link asChild active={isActive}> | ||
<NextLink | ||
href={href} | ||
prefetch | ||
className={` ${isActive ? "text-red-600" : ""}`} | ||
{...props} | ||
/> | ||
</NM.Link> | ||
); | ||
}; | ||
|
||
export default NavLink; |
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