1- import { Link } from "@remix-run/react" ;
1+ import { NavLink } from "@remix-run/react" ;
22import React from "react" ;
33
44import Logo from "~/components/Logo" ;
@@ -8,34 +8,25 @@ import CloseIcon from "./icons/Close";
88
99const NAV_ITEMS = [
1010 {
11- id : 1 ,
1211 label : "Member List" ,
13- href : "/" ,
12+ href : "/dashboard " ,
1413 } ,
1514 {
16- id : 1 ,
17- label : "New Member" ,
18- href : "/dashboard/new" ,
19- } ,
20- {
21- id : 2 ,
2215 label : "Member Details" ,
2316 href : "/dashboard/14c8afd0-50cc-4aca-9547-c997ed306065" ,
2417 } ,
2518 {
26- id : 3 ,
27- label : "Reset Pasword" ,
28- href : "/reset-password" ,
19+ label : "New Member" ,
20+ href : "/dashboard/new" ,
2921 } ,
3022 {
31- id : 4 ,
32- label : "Sign Up" ,
33- href : "/signup" ,
23+ label : "User Profile" ,
24+ href : "/dashboard/user" ,
3425 } ,
3526 {
36- id : 5 ,
37- label : "Docs: Remix on Netlify" ,
27+ label : "Remix on Netlify" ,
3828 href : "https://docs.netlify.com/frameworks/remix/" ,
29+ newTab : true ,
3930 } ,
4031] ;
4132
@@ -64,22 +55,40 @@ export default function Sidebar({ isOpen, setIsOpen }: Props) {
6455
6556 < div className = "overflow-x-hidden overflow-y-scroll hide-scrollbar" >
6657 < ul className = "border-t border-slate-200" >
67- { NAV_ITEMS . map ( ( item , index ) => (
68- < li key = { item . id } >
69- < Link
70- key = { item . id }
58+ { NAV_ITEMS . map ( ( item ) => (
59+ < li key = { item . label } >
60+ < NavLink
7161 to = { item . href }
72- className = "flex items-center justify-between px-2 py-4 border-b border-slate-200 group hover:border-cyan-300"
62+ className = { ( { isActive } ) =>
63+ isActive
64+ ? "flex items-center justify-between px-2 py-4 border-b border-cyan-300"
65+ : "flex items-center justify-between px-2 py-4 border-b border-slate-200 group hover:border-cyan-300"
66+ }
67+ { ...( item . newTab && {
68+ target : "_blank" ,
69+ rel : "noopener noreferer" ,
70+ } ) }
71+ end
7372 >
74- { item . label }
75- < span className = "text-slate-300 group-hover:text-cyan-300" >
76- { index + 1 === NAV_ITEMS . length ? (
77- < ArrowTopRightIcon />
78- ) : (
79- < ArrowRightIcon />
80- ) }
81- </ span >
82- </ Link >
73+ { ( { isActive } ) => (
74+ < >
75+ { item . label }
76+ < span
77+ className = {
78+ isActive
79+ ? "text-cyan-300"
80+ : "text-slate-300 group-hover:text-cyan-300"
81+ }
82+ >
83+ { item . newTab ? (
84+ < ArrowTopRightIcon />
85+ ) : (
86+ < ArrowRightIcon />
87+ ) }
88+ </ span >
89+ </ >
90+ ) }
91+ </ NavLink >
8392 </ li >
8493 ) ) }
8594 </ ul >
0 commit comments