Skip to content
Snippets Groups Projects
Commit f9082223 authored by Jacopo Gasparetto's avatar Jacopo Gasparetto
Browse files

Add hover on current path selection to sidebar

parent b95d56dc
No related branches found
No related tags found
No related merge requests found
import React from 'react';
import { routes } from '../routes'; import { routes } from '../routes';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
export const Drawer = () => { export const Drawer = () => {
const path = window.location.pathname;
const links = routes.map(route => { const links = routes.map(route => {
let className = "h-10 hover:bg-neutral-300 rounded-lg p-2";
className += route.path === path ? " bg-neutral-200" : "";
return ( return (
<li key={route.path}> <li className={className} key={route.path}>
<Link to={route.path}>{route.title}</Link> <Link className="block h-10" to={route.path}>{route.title}</Link>
</li> </li>
) )
}); });
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment