Skip to content

Commit

Permalink
refactor: only apply breadcrumb/current page styles depending on how …
Browse files Browse the repository at this point in the history
…the link is matched
  • Loading branch information
jerelmiller committed Aug 7, 2020
1 parent 9af0f49 commit 9e0147b
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 12 deletions.
24 changes: 16 additions & 8 deletions src/components/NavigationItems.js
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,26 @@ const NavItem = ({ page, depthLevel, searchTerm, filteredPageNames }) => {
>
{page.url ? (
<Link
activeStyle={{ fontWeight: 'bold' }}
partiallyActive
onClick={
isToggleable ? () => setToggleIsExpanded(!toggleIsExpanded) : null
}
className={cx(
{
[styles.isCurrentPage]: isCurrentPage,
[styles.isBreadCrumb]: isBreadCrumb,
},
styles.navLink
)}
css={css`
color: var(--primary-text-color);
`}
getProps={({ isCurrent, isPartiallyCurrent }) => {
if (isCurrent) {
return { className: cx(styles.navLink, styles.isCurrentPage) };
}

if (isPartiallyCurrent) {
return {
className: cx(styles.navLink, styles.isBreadCrumb),
};
}

return { className: styles.navLink };
}}
to={page.url}
>
<span className={styles.navLinkText}>
Expand Down
8 changes: 4 additions & 4 deletions src/components/NavigationItems.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,15 +67,15 @@ button.navLink {
}
}

.isCurrentPage {
font-weight: bold;
}

.isBreadCrumb {
font-weight: bold !important;
}

.filterOn {
ul {
display: block;
}

.groupName {
margin-top: 0.5rem;
}
Expand Down

0 comments on commit 9e0147b

Please sign in to comment.