{"ast":null,"code":"import { jsx as _jsx } from \"react/jsx-runtime\";\nimport Link from 'next/link';\nimport { useRouter } from 'next/router';\nimport cn from 'classnames';\nimport styles from './CustomLink.module.scss';\nimport AnchorLink from 'react-anchor-link-smooth-scroll';\nimport { useIsDesktop } from 'hooks/useIsDevice';\n\nconst CustomLink = ({\n  children,\n  label,\n  className,\n  type,\n  slug,\n  as,\n  href,\n  active,\n  activeStyle,\n  onClick\n}) => {\n  const router = useRouter();\n\n  const _href = href || (type ? `/${type}/[slug]` : `${slug}`);\n\n  const _as = as || type && `/${type}${slug !== '/' ? '/' + slug : ''}` || _href;\n\n  const isDesktop = useIsDesktop();\n\n  if (_href.indexOf('#') != -1) {\n    // anchor\n    const hrefParts = _href.split('#');\n\n    if (hrefParts[0] == '' || hrefParts[0] == router.asPath) {\n      return /*#__PURE__*/_jsx(AnchorLink, {\n        href: '#' + hrefParts[1],\n        onClick: onClick,\n        offset: () => isDesktop ? 0 : 72,\n        className: cn(styles.customLink, (active || router.asPath === _as) && (activeStyle || styles['is-active']), className),\n        children: children || label\n      });\n    }\n  }\n\n  return /*#__PURE__*/_jsx(Link, {\n    as: _as,\n    href: _href //scroll={false}\n    ,\n    children: /*#__PURE__*/_jsx(\"a\", {\n      className: cn(styles.customLink, (active || router.asPath === _as) && (activeStyle || styles['is-active']), className),\n      onClick: onClick,\n      children: children || label\n    })\n  });\n};\n\nexport default CustomLink;","map":null,"metadata":{},"sourceType":"module"}