Skip to content

Commit 6ad2cc5

Browse files
authored
Merge pull request #1174 from civictechindex/nav-hover-shift-1139
Fixed "wiggle" problem with large Header links
2 parents 47017c1 + e8e8084 commit 6ad2cc5

File tree

1 file changed

+20
-3
lines changed

1 file changed

+20
-3
lines changed

src/components/Header/NavLink.js

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,24 @@ import {
1111
import { navigation } from '../../navigation';
1212

1313
const useStyles = makeStyles({
14-
active: {
14+
link: {
15+
fontWeight: 500,
16+
'&:after': {
17+
display: 'block',
18+
content: 'attr(title)',
19+
fontWeight: 700,
20+
height: '1px',
21+
visibility: 'hidden',
22+
},
23+
},
24+
activeLink: {
1525
fontWeight: 700,
26+
'&:hover': {
27+
fontWeight: 700,
28+
},
29+
'&:active': {
30+
fontWeight: 700,
31+
},
1632
},
1733
menu: {
1834
padding: '0',
@@ -25,7 +41,7 @@ const useStyles = makeStyles({
2541
},
2642
});
2743

28-
const NavLink = ({ label, id, children, header, route, title }) => {
44+
const NavLink = ({ id, children, header, route }) => {
2945
const classes = useStyles();
3046
const location = useLocation();
3147
const popupState = usePopupState({ variant: 'popper', popupId: 'navlink' });
@@ -46,10 +62,11 @@ const NavLink = ({ label, id, children, header, route, title }) => {
4662
return (
4763
<>
4864
<Link
49-
className={active || popupState.isOpen ? classes.active : null}
65+
className={active || popupState.isOpen ? classes.activeLink : classes.link}
5066
component={NaviLink}
5167
exact
5268
to={route}
69+
title={header}
5370
underline='none'
5471
{...bindHover(popupState)}
5572
>

0 commit comments

Comments
 (0)