Skip to content

Commit 48546b6

Browse files
authored
Merge pull request #571 from NejcZdovc/hotfix/#570-anchor-links
Fixed anchor url's
2 parents b40d61b + b543acb commit 48546b6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

components/sidebar-item/sidebar-item.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ export default class SidebarItem extends React.Component {
1616
let emptyMod = !anchors.length ? 'sidebar-item--empty' : '';
1717
let active = `/${currentPage}` === url;
1818
let openMod = (active || this.state.open) ? 'sidebar-item--open' : '';
19+
let anchorUrl = (active) ? '#' : url + '#';
1920

2021
return (
2122
<div className={ `sidebar-item ${emptyMod} ${openMod}` }>
@@ -25,7 +26,7 @@ export default class SidebarItem extends React.Component {
2526
{
2627
anchors.map((anchor, j) => (
2728
<li className="sidebar-item__anchor" key={ `anchor-${index}-${j}` }>
28-
<a href={ '#' + anchor.id }>{ anchor.title}</a>
29+
<a href={ anchorUrl + anchor.id }>{ anchor.title}</a>
2930
</li>
3031
))
3132
}

0 commit comments

Comments
 (0)