UNPKG

@websolutespa/payload-plugin-bowl

Version:

Bowl PayloadCms plugin of the BOM Repository

47 lines (46 loc) 1.61 kB
'use client'; import { jsx as _jsx } from "react/jsx-runtime"; import { Link, useConfig } from '@payloadcms/ui'; import { getClassNames } from '@websolutespa/bom-core'; import { usePathname } from 'next/navigation'; import React from 'react'; export const CategoryMenu = (props)=>{ const { collectionSlug } = props; const slug = collectionSlug; const { config } = useConfig(); const { routes } = config; const pathname = usePathname(); const items = [ { name: 'List', url: `${routes.admin}/collections/${slug}` }, { name: 'Tree', url: `${routes.admin}/tree/${slug}` } ]; const isActive = (url)=>{ // console.log('isActive', pathname, url); return pathname === url; }; return /*#__PURE__*/ _jsx("div", { className: "category-menu", children: /*#__PURE__*/ _jsx("div", { className: "tabs-field__tabs-wrap", children: /*#__PURE__*/ _jsx("div", { className: "tabs-field__tabs", children: items.map((item, i)=>/*#__PURE__*/ _jsx(Link, { className: getClassNames('tabs-field__tab-button', { 'tabs-field__tab-button--active': isActive(item.url) }), href: item.url, children: /*#__PURE__*/ _jsx("span", { children: item.name }) }, i)) }) }) }); }; //# sourceMappingURL=CategoryMenu.js.map