index button highlight

This commit is contained in:
MrFry 2020-03-15 11:44:22 +01:00
parent dd0ad7731b
commit 255d892177

View file

@ -4,7 +4,11 @@ import tabs from '../data/tabs.json'
import constants from '../constants.json' import constants from '../constants.json'
export default function Layout (props) { export default function Layout (props) {
const { route } = props let href = props.route
if (href === '/' || href === '') {
href = 'index'
}
return ( return (
<div> <div>
@ -24,7 +28,7 @@ export default function Layout (props) {
return ( return (
<Link href={item.href} key={key} > <Link href={item.href} key={key} >
<a <a
className={route.includes(key) ? 'active' : ''} className={href.includes(key) ? 'active' : ''}
>{item.text}</a> >{item.text}</a>
</Link> </Link>
) )