Skip to content

Commit

Permalink
remove default acitve index
Browse files Browse the repository at this point in the history
  • Loading branch information
dobri1408 committed Apr 13, 2023
1 parent 5020467 commit 57235c6
Showing 1 changed file with 2 additions and 11 deletions.
13 changes: 2 additions & 11 deletions src/ui/Header/HeaderMenuPopUp.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,7 @@ const SecondLevelContent = ({ element, topics = false, renderMenuItem }) => {

const NestedAccordion = ({ menuItems, renderMenuItem, pathName }) => {
const [activeIndex, setActiveIndex] = useState(-1);

useEffect(() => {
let index = 0;
menuItems.forEach((menuItem) => {
Expand All @@ -253,14 +254,10 @@ const NestedAccordion = ({ menuItems, renderMenuItem, pathName }) => {
});
}, [menuItems, pathName]);

let defaultIndex = -1;
const rootPanels = [];
menuItems.forEach((element, index) => {
let x = {};
x.key = index;
if (pathName.indexOf(element.url) !== -1) {
defaultIndex = index;
}
x.title = (
<Accordion.Title
key={`title-${index}`}
Expand Down Expand Up @@ -306,13 +303,7 @@ const NestedAccordion = ({ menuItems, renderMenuItem, pathName }) => {
rootPanels.push(x);
});

return (
<Accordion
activeIndex={activeIndex}
defaultActiveIndex={defaultIndex}
panels={rootPanels}
/>
);
return <Accordion activeIndex={activeIndex} panels={rootPanels} />;
};

function HeaderMenuPopUp({
Expand Down

0 comments on commit 57235c6

Please sign in to comment.