Skip to content

Commit

Permalink
fix(ui): fix settings tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
ncarlier committed Oct 5, 2019
1 parent b2c0858 commit 884a9f9
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions ui/src/settings/components/Tabs.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from 'react'
import { RouteComponentProps, withRouter } from 'react-router'

import LinkIcon from '../../components/LinkIcon'
import styles from './Tabs.module.css'
Expand All @@ -13,16 +14,21 @@ interface Props {
items: TabItem[]
}

export default ({ items }: Props) => (
export default withRouter(({ location: { pathname }, items }: Props & RouteComponentProps) => (
<nav className={styles.tabs}>
<ul>
{items.map(item => (
<li key={item.key}>
<LinkIcon to={`/settings/${item.key}`} title={item.label} icon={item.icon}>
<LinkIcon
to={`/settings/${item.key}`}
title={item.label}
icon={item.icon}
active={pathname.startsWith(`/settings/${item.key}`)}
>
<span>{item.label}</span>
</LinkIcon>
</li>
))}
</ul>
</nav>
)
))

0 comments on commit 884a9f9

Please sign in to comment.