Skip to content

Commit

Permalink
personalizar lista de links
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielmaldo25 committed May 17, 2024
1 parent aa225f2 commit a03193e
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/components/public/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppBar } from '@material-ui/core'
import React from 'react'
import { Link } from 'react-router-dom'
import { Link, useLocation } from 'react-router-dom'
import { ReactComponent as LogoHorizontal } from '../../assets/logo-horizontal.svg'
import { Link as MaterialLink } from '@material-ui/core'

Expand All @@ -10,7 +10,14 @@ interface CustomLinkProps {
}

const CustomLink = ({ children, to }: CustomLinkProps) => {
return <Link to={to}>{children} </Link>
const location = useLocation()
console.log({ location })
const hovered = location.pathname === to
return (
<Link to={to} className={hovered ? 'bg-neutral-gray p-2 rounded-md' : ''}>
{children}{' '}
</Link>
)
}

function Layout({ children }) {
Expand Down

0 comments on commit a03193e

Please sign in to comment.