import { Link } from "react-router-dom"; import PropTypes from "prop-types"; import { useTranslation } from "react-i18next"; function SubMenu({ items }) { const { t } = useTranslation(); return (
{items.map((subItem, index) => (
{t(subItem.name)}
))}
); }; function MenuBar({ menuItems }) { const { t } = useTranslation(); return (
{menuItems.map((item, index) =>
{t(item.name)} {item.submenu.length > 0 && }
)}
); } MenuBar.propTypes = { menuItems: PropTypes.arrayOf( PropTypes.shape({ name: PropTypes.string.isRequired, submenu: PropTypes.arrayOf( PropTypes.shape({ name: PropTypes.string.isRequired, path: PropTypes.string.isRequired, }) ), path: PropTypes.string }) ).isRequired }; SubMenu.propTypes = { items: PropTypes.arrayOf( PropTypes.shape({ name: PropTypes.string.isRequired, path: PropTypes.string.isRequired }) ).isRequired }; export default MenuBar;