22
33import React , { useState , useRef } from "react" ;
44import Link from "next/link" ;
5+ import Image from "next/image" ;
56import { usePathname } from "next/navigation" ;
67import { NavbarType } from "@/types/CommonTypes" ;
7-
8- // const languages = [
9- // { label: "English", value: "en" },
10- // { label: "සිංහල", value: "si" },
11- // { label: "தமிழ்", value: "ta" },
12- // ];
8+ import arthritisLogo from "/public/arthritis_logo.png" ; // Adjust the path as needed
139
1410export default function Navbar ( { data } : { data : NavbarType } ) {
1511 const { link, navbarButton } = data ;
1612
1713 const [ isOpen , setIsOpen ] = useState ( false ) ;
18- // const [isDropdownOpen, setIsDropdownOpen] = useState(false);
19- // const [selectedLanguage, setSelectedLanguage] = useState("en");
2014 const pathname = usePathname ( ) ;
2115 const dropdownRef = useRef < HTMLDivElement > ( null ) ;
2216
2317 const toggleMenu = ( ) => setIsOpen ( ! isOpen ) ;
2418 const closeMenu = ( ) => setIsOpen ( false ) ;
2519
26- // const toggleDropdown = () => setIsDropdownOpen(!isDropdownOpen);
27- // const closeDropdown = () => setIsDropdownOpen(false);
28-
29- // const handleLanguageSelect = (lang: string) => {
30- // setSelectedLanguage(lang);
31- // closeDropdown();
32- // };
33-
34- // useEffect(() => {
35- // const handleClickOutside = (event: MouseEvent) => {
36- // if (
37- // dropdownRef.current &&
38- // !dropdownRef.current.contains(event.target as Node)
39- // ) {
40- // closeDropdown();
41- // }
42- // };
43-
44- // const handleEscape = (event: KeyboardEvent) => {
45- // if (event.key === "Escape") {
46- // closeDropdown();
47- // }
48- // };
49-
50- // document.addEventListener("mousedown", handleClickOutside);
51- // document.addEventListener("keydown", handleEscape);
52-
53- // return () => {
54- // document.removeEventListener("mousedown", handleClickOutside);
55- // document.removeEventListener("keydown", handleEscape);
56- // };
57- // }, []);
58-
5920 return (
6021 < header className = "bg-white shadow sticky top-0 z-50" >
6122 < div className = "container mx-auto px-4 flex items-center justify-between py-4" >
62- < Link
63- href = "/"
64- className = "text-2xl font-bold text-[#2F7CC4] flex-shrink-0"
65- >
66- Rheuma< span className = "text-gray-800" > Connect</ span >
23+ < Link href = "/" className = "flex-shrink-0" >
24+ < Image
25+ src = "/arthritis_logo.png"
26+ alt = "Arthritis Logo"
27+ width = { 175 } // Adjust the width as neede
28+ height = { 70 }
29+ className = "cursor-pointer"
30+ />
6731 </ Link >
6832
6933 < nav className = "hidden md:flex items-center gap-x-6" >
@@ -87,43 +51,6 @@ export default function Navbar({ data }: { data: NavbarType }) {
8751 { navbarButton ?. buttonText }
8852 </ button >
8953 </ Link >
90-
91- { /* <div className="relative" ref={dropdownRef}>
92- <button
93- onClick={toggleDropdown}
94- className="bg-white border border-gray-400 text-gray-800 rounded-[10px] text-[14px] font-medium flex items-center justify-center hover:bg-gray-100 transition"
95- style={{ width: "98px", height: "38px", lineHeight: "18px" }}>
96- <span>English</span>
97- <svg
98- className={`w-4 h-4 text-black transform ${
99- isDropdownOpen ? "rotate-180" : "rotate-0"
100- }`}
101- fill="none"
102- stroke="currentColor"
103- strokeWidth="2"
104- viewBox="0 0 24 24"
105- xmlns="http://www.w3.org/2000/svg">
106- <path
107- strokeLinecap="round"
108- strokeLinejoin="round"
109- d="M19 9l-7 7-7-7"
110- />
111- </svg>
112- </button>
113-
114- {isDropdownOpen && (
115- <div className="absolute mt-2 w-40 bg-white border border-gray-200 rounded shadow-lg">
116- {languages.map(({ label, value }) => (
117- <button
118- key={value}
119- onClick={() => handleLanguageSelect(value)}
120- className="block w-full text-left px-4 py-2 hover:bg-gray-200 text-gray-800">
121- {label}
122- </button>
123- ))}
124- </div>
125- )}
126- </div> */ }
12754 </ nav >
12855
12956 < button
@@ -196,44 +123,7 @@ export default function Navbar({ data }: { data: NavbarType }) {
196123 </ button >
197124 < div className = "mt-4" >
198125 < div className = "relative" ref = { dropdownRef } >
199- { /* <button
200- onClick={toggleDropdown}
201- className="px-4 py-2 bg-white border border-gray-300 rounded-full text-sm flex items-center space-x-2 shadow-sm hover:bg-gray-100 transition w-full">
202- <span className="text-black">
203- {
204- languages.find(
205- (lang) => lang.value === selectedLanguage
206- )?.label
207- }
208- </span>
209- <svg
210- className={`w-4 h-4 text-black transform ${
211- isDropdownOpen ? "rotate-180" : "rotate-0"
212- }`}
213- fill="none"
214- stroke="currentColor"
215- strokeWidth="2"
216- viewBox="0 0 24 24"
217- xmlns="http://www.w3.org/2000/svg">
218- <path
219- strokeLinecap="round"
220- strokeLinejoin="round"
221- d="M19 9l-7 7-7-7"
222- />
223- </svg>
224- </button> */ }
225- { /* {isDropdownOpen && (
226- <div className="absolute mt-2 w-full bg-white border border-gray-200 rounded shadow-lg">
227- {languages.map(({ label, value }) => (
228- <button
229- key={value}
230- onClick={() => handleLanguageSelect(value)}
231- className="block w-full text-left px-4 py-2 hover:bg-gray-200 text-gray-800">
232- {label}
233- </button>
234- ))}
235- </div>
236- )} */ }
126+ { /* Language dropdown code here */ }
237127 </ div >
238128 </ div >
239129 </ div >
0 commit comments