UNPKG

@alauda/doom

Version:

Doctor Doom making docs.

13 lines (12 loc) 1.06 kB
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime"; import { Tag } from '@rspress/core/theme'; import { isExternalUrl } from '@rspress/shared'; import { useMemo } from 'react'; import styles from '../../../styles/versions-nav.module.scss'; import { withoutBase } from '../../shared/index.js'; export function NavMenuSingleItem({ activeMatch, base, compact, download, link, pathname, rightIcon, text, tag, }) { const isActive = useMemo(() => !!base && !!pathname && new RegExp(activeMatch || link).test(withoutBase(pathname, base)), [activeMatch, base, link, pathname]); return (_jsx("a", { href: link, download: download, target: isExternalUrl(link) ? '_blank' : undefined, rel: "noopener noreferrer", children: _jsxs("div", { className: `rspress-nav-menu-item ${styles.singleItem} ${isActive ? `${styles.activeItem} rspress-nav-menu-item-active` : ''} rp-text-sm rp-font-medium ${compact ? 'rp-mx-0.5' : 'rp-mx-1.5'} rp-px-3 rp-py-2 rp-flex rp-items-center`, children: [_jsx(Tag, { tag: tag }), text, rightIcon] }) }, link)); }