Skip to content

Commit

Permalink
docs: check for pathprefix when selecting sidebar content
Browse files Browse the repository at this point in the history
  • Loading branch information
darthtrevino committed Nov 6, 2018
1 parent 13a2499 commit 48a1bf2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 3 additions & 1 deletion packages/documentation/src/components/layout.tsx
Expand Up @@ -21,7 +21,9 @@ export interface LayoutProps {
const Layout: React.SFC<LayoutProps> = props => {
const { children, location } = props
const sitepath = location && location.pathname
const isExampleUrl = (sitepath || '').startsWith('/examples')
const isExampleUrl = (sitepath || '')
.replace('/react-dnd', '')
.startsWith('/examples')
const sidebarItems: PageGroup[] = isExampleUrl ? ExamplePages : APIPages
const hideSidebar = props.hideSidebar || sitepath === '/about'
return (
Expand Down
4 changes: 1 addition & 3 deletions packages/documentation/src/components/sidebar.tsx
Expand Up @@ -20,9 +20,7 @@ const SideBar: React.SFC<SideBarProps> = ({ groups, location }) => {
}

function renderLink({ title, location: pageLocation }: Page, key: string) {
const isSelected =
pageLocation === location ||
pageLocation === location.replace('/react-dnd', '')
const isSelected = pageLocation === location.replace('/react-dnd', '')
const arrow = <span className="arrowBullet" />
const Link = isSelected ? SelectedSidebarItem : SidebarItem

Expand Down

0 comments on commit 48a1bf2

Please sign in to comment.