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 && return ( {item.label} {submenuIcon} {badge} ); } const renderLink = (item, i) => { let content = renderLinkContent(item); if (item.to) { return ( onMenuItemClick(e, item, i)} exact target={item.target}> {content} ) } else { return ( onMenuItemClick(e, item, i)} target={item.target}> {content} ); } } let items = props.items && props.items.map((item, i) => { let active = activeIndex === i; let styleClass = classNames(item.badgeStyleClass, {'layout-menuitem-category': props.root, 'active-menuitem': active && !item.to }); if(props.root) { return (
  • {props.root === true &&
    {item.label}
    }
  • ); } else { return (
  • {renderLink(item, i)}
  • ); } }); return items ? : null; } export const AppMenu = (props) => { return (
    primeblocks
    ); }