File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change
1
+ "use client"
1
2
import ccLogo from "../assets/codechef_logo.svg" ;
2
3
import Image from "next/image" ;
3
4
import { Button } from "@/components/ui/button" ;
4
5
import ModeToggle from "@/components/toggle-theme" ;
5
6
import { ArrowUpToLine } from "lucide-react" ;
6
7
import Link from "next/link" ;
8
+ import { usePathname } from "next/navigation" ;
7
9
8
10
function Navbar ( ) {
11
+ const pathname = usePathname ( ) ;
12
+
9
13
return (
10
14
< div className = "flex items-center justify-between gap-x-3 w-[90%] md:w-full overflow-x-hidden px-2 py-6 md:px-12" >
11
15
< div className = "hidden w-[20%] md:block" >
@@ -31,10 +35,10 @@ function Navbar() {
31
35
< ModeToggle />
32
36
</ div >
33
37
34
- < Link href = "/upload" >
38
+ < Link href = { pathname == "/upload" ? "/" : "/upload" } >
35
39
< div className = "md:p-[2px] bg-gradient-to-r from-[#562EE7] to-[#bd21b4] rounded-full" >
36
40
< div className = "whitespace-nowrap rounded-full font-bold text-xs md:text-sm mt-2 md:mt-0 bg-slate-200 dark:bg-black px-4 md:px-6 py-3 tracking-wider text-black dark:text-white font-sans hover:bg-white dark:hover:bg-slate-700" >
37
- ⇱ UPLOAD PAPERS
41
+ { pathname == "/upload" ? "⇱ SEARCH PAPERS" : "⇱ UPLOAD PAPERS" }
38
42
</ div >
39
43
</ div >
40
44
</ Link >
You can’t perform that action at this time.
0 commit comments