import clsx from "clsx"; import Link from "../Link"; import type { Route } from "next"; import type { IconType } from "react-icons"; import styles from "./MenuItem.module.css"; export type MenuItemProps = { text?: string; href?: Route; icon?: IconType; current?: boolean; className?: string; }; const MenuItem = ({ text, href, icon, current, className }: MenuItemProps) => { const Icon = icon; const item = ( <> {Icon && } {text && {text}} ); // allow both navigational links and/or other interactive react components (e.g. the theme toggle) if (href) { return ( {item} ); } return item; }; export default MenuItem;