Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FDA-134 Build fix for window undefined error. #191

Merged
merged 2 commits into from Sep 11, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 16 additions & 26 deletions src/components/DocSidebar.jsx
Expand Up @@ -44,14 +44,14 @@ const SectionLinks = props => {
)
}

// const APINavLink = props => {
// let isActive = window.location.href.endsWith(props.to);
// let className = isActive ? props.className +" sidebar-item-active" : props.className;
//
// return (
// <Link {...props} className={className}> {props.title}</Link>
// );
// }
const APINavLink = props => {
let isActive = typeof window !== "undefined" ? window.location.href.endsWith(props.to) : false;
let className = isActive ? props.className +" sidebar-item-active" : props.className;

return (
<Link {...props} className={className}> {props.title}</Link>
);
}

const SectionLink = props => {

Expand Down Expand Up @@ -102,24 +102,14 @@ const SectionLink = props => {
{title}
</a>
) : (
<Link
to={link}
key={link}
className={itemCx}
activeClassName='sidebar-item-active'
onClick={props.toggleMobileSidebar}
exact
>
{title}
</Link>
// <APINavLink
// to={link}
// key={link}
// className={itemCx}
// activeClassName='sidebar-item-active'
// onClick={props.toggleMobileSidebar}
// title={title}
// />
<APINavLink
to={link}
key={link}
className={itemCx}
activeClassName='sidebar-item-active'
onClick={props.toggleMobileSidebar}
title={title}
/>
)
}
{childnodes ?
Expand Down