Skip to content

Commit

Permalink
fix: slugify nav items so they can contain quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
clarkmcadoo committed Apr 19, 2024
1 parent 7d62e12 commit 1d32c24
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/components/Navigation.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { css } from '@emotion/react';
import { NavItem } from '@newrelic/gatsby-theme-newrelic';
import { Flipped, Flipper } from 'react-flip-toolkit';

const slugify = require('../../scripts/utils/slugify');

const Navigation = ({ nav, className }) => {
const subNav = nav.url === '/docs/style-guide';
const [flipKey, setFlipKey] = useState();
Expand Down Expand Up @@ -86,8 +88,8 @@ const Navigation = ({ nav, className }) => {
const addFlipIds = (pages, parentKey = []) =>
pages?.map((page) => ({
...page,
flipId: [...parentKey, page.title],
pages: addFlipIds(page.pages, [...parentKey, page.title]),
flipId: [...parentKey, slugify(page.title)],
pages: addFlipIds(page.pages, [...parentKey, slugify(page.title)]),
}));

export default Navigation;

0 comments on commit 1d32c24

Please sign in to comment.