Skip to content

Commit

Permalink
fix(navigation): fix page tabs replace bug (#437)
Browse files Browse the repository at this point in the history
* fix(navigation): fix page tabs replace bug

* fix: update regex

* fix: clean up code

* fix: rename var
  • Loading branch information
jnm2377 authored and emyarod committed Sep 24, 2019
1 parent ec84761 commit 38fe06b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ export default class PageTabs extends React.Component {
const pageTabs = tabs.map(tab => {
const slugifiedTab = slugify(tab, { lower: true });
const selected = slugifiedTab === currentTab;
const href = slug.replace(currentTab, slugifiedTab);
const currentTabRegex = new RegExp(`${currentTab}(?!-)`);
const href = slug.replace(currentTabRegex, slugifiedTab);
return (
<li key={tab} className={cx({ [selectedItem]: selected }, listItem)}>
<Link className={link} to={`${href}`}>
Expand Down

1 comment on commit 38fe06b

@vercel
Copy link

@vercel vercel bot commented on 38fe06b Sep 24, 2019

Choose a reason for hiding this comment

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

Please sign in to comment.