Skip to content

Commit

Permalink
Fix scroll for no-hash links
Browse files Browse the repository at this point in the history
  • Loading branch information
psdcoder committed Apr 3, 2020
1 parent 2d84313 commit 3f85dc6
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/components/Link/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,10 @@ const Link: React.SFC<ILinkProps> = ({
) {
e.preventDefault()

if (location.hash) {
if (currentLocation.hash !== location.hash) {
navigate(href)
} else {
scrollIntoLayout(document.querySelector(location.hash))
}
if (currentLocation.hash !== location.hash) {
navigate(href)
} else {
scrollIntoLayout(document.querySelector(location.hash))
}
}

Expand Down

0 comments on commit 3f85dc6

Please sign in to comment.