import React, { useState } from 'react';
import { NavLink } from 'react-router-dom';
import { CSSTransition } from 'react-transition-group';
import classNames from 'classnames';
import { Ripple } from 'primereact/ripple';
import { Badge } from 'primereact/badge';
const AppSubmenu = (props) => {
const [activeIndex, setActiveIndex] = useState(null);
const onMenuItemClick = (event, item, index) => {
//avoid processing disabled items
if (item.disabled) {
event.preventDefault();
return true;
}
//execute command
if (item.command) {
item.command({ originalEvent: event, item: item });
}
if (index === activeIndex) setActiveIndex(null);
else setActiveIndex(index);
if (props.onMenuItemClick) {
props.onMenuItemClick({
originalEvent: event,
item: item,
});
}
};
const onKeyDown = (event) => {
if (event.code === 'Enter' || event.code === 'Space') {
event.preventDefault();
event.target.click();
}
};
const renderLinkContent = (item) => {
let submenuIcon = item.items && (
);
let badge = item.badge &&