Skip to content

Commit

Permalink
feat: Add current page indicator to selected page
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Jun 17, 2020
1 parent b75f5bc commit 0d1cdd5
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/components/FeatherIcon.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ const ICONS = {
<path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" />
</>
),
'chevron-right': <polyline points="9 18 15 12 9 6" />,
clock: (
<>
<circle cx="12" cy="12" r="10" />
Expand Down
7 changes: 7 additions & 0 deletions src/components/Sidebar.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { Link } from 'gatsby';
import cx from 'classnames';
import { BreadcrumbContext } from './BreadcrumbContext';

import FeatherIcon from './FeatherIcon';
import Logo from './Logo';
import { link } from '../types';
import styles from './Sidebar.module.scss';
Expand All @@ -27,6 +28,12 @@ const renderNav = (pages, depthLevel = 0) => {
{page.url ? (
<Link className={styles.navItem} to={page.url}>
{page.displayName}
{isCurrentPage && (
<FeatherIcon
className={styles.currentPageIndicator}
name="chevron-right"
/>
)}
</Link>
) : (
<div
Expand Down
15 changes: 9 additions & 6 deletions src/components/Sidebar.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,6 @@
list-style: none;
}

a {
text-decoration: none;
color: var(--color-black);
display: inline-block;
}

h3 {
margin: 0;
}
Expand Down Expand Up @@ -72,7 +66,16 @@
}

.navItem {
color: var(--color-black);
margin-bottom: 1rem;
display: flex;
align-items: center;
justify-content: space-between;
text-decoration: none;
}

.currentPageIndicator {
stroke-width: 4;
}

.navDepth0 {
Expand Down

0 comments on commit 0d1cdd5

Please sign in to comment.