Skip to content

Commit 5628497

Browse files
authored
Merge pull request #206 from data-driven-forms/fix-nav-highlight
Fixed demo navigation highlight.
2 parents 1ed71f6 + 53f1b69 commit 5628497

File tree

1 file changed

+8
-1
lines changed
  • packages/react-renderer-demo/src/app/src/components/navigation

1 file changed

+8
-1
lines changed

packages/react-renderer-demo/src/app/src/components/navigation/mapper.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import React, { useState, forwardRef } from 'react';
2+
import PropTypes from 'prop-types';
23
import List from '@material-ui/core/List';
34
import ListItem from '@material-ui/core/ListItem';
45
import ListItemText from '@material-ui/core/ListItemText';
@@ -22,7 +23,7 @@ const Item = ({ href, linkText, component }) => {
2223
return (
2324
<ListItem
2425
button
25-
selected={ href === router.pathname }
26+
selected={ href.replace('/?', '?') === router.asPath }
2627
key={ href || linkText }
2728
className={ classes.nested }
2829
component={ forwardRef((props, ref) => (
@@ -42,6 +43,12 @@ const Item = ({ href, linkText, component }) => {
4243
);
4344
};
4445

46+
Item.propTypes = {
47+
href: PropTypes.string.isRequired,
48+
linkText: PropTypes.string,
49+
component: PropTypes.node,
50+
};
51+
4552
const FinalList = ({
4653
title,
4754
level,

0 commit comments

Comments
 (0)