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

Adding active style to side nav links #281

Merged
merged 10 commits into from
Sep 27, 2018
22 changes: 18 additions & 4 deletions pages/doc-components/Header.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import React from 'react'
import {withRouter} from 'next/router'
import Octicon, {MarkGithub} from '@githubprimer/octicons-react'
import NextLink from 'next/link'
import BoxShadow from './BoxShadow'
import {Text, FlexContainer, Link, Sticky} from '../../src'

const Header = () => (
const Header = ({router}) => (
<Sticky zIndex={100}>
<BoxShadow py={3} bg="gray.9" color="white">
<FlexContainer className="p-responsive" alignItems="center" justifyContent="space-between">
Expand All @@ -18,12 +19,25 @@ const Header = () => (
</NextLink>
<div>
<NextLink href="/components">
<Link nounderline className="text-white" href="/components" px={4}>
<Link
nounderline
className="text-white"
href="/components"
px={4}
fontWeigt={router.pathname === '/components' ? 'bold' : null}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like we're missing the "h" in fontWeight here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ahhhhh

>
Docs
</Link>
</NextLink>
<NextLink href="/components/sandbox">
<Link nounderline className="text-white" href="/components/sandbox" mr={0} px={4}>
<Link
nounderline
className="text-white"
href="/components/sandbox"
mr={0}
px={4}
fontWeigt={router.pathname === '/components/sandbox' ? 'bold' : null}
>
Sandbox
</Link>
</NextLink>
Expand All @@ -33,4 +47,4 @@ const Header = () => (
</Sticky>
)

export default Header
export default withRouter(Header)