{"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\nvar CustomLink = function CustomLink(_ref) {\n  var children = _ref.children,\n      label = _ref.label,\n      className = _ref.className,\n      type = _ref.type,\n      slug = _ref.slug,\n      as = _ref.as,\n      href = _ref.href,\n      active = _ref.active,\n      activeStyle = _ref.activeStyle,\n      onClick = _ref.onClick;\n  var router = useRouter();\n\n  var _href = href || (type ? \"/\".concat(type, \"/[slug]\") : \"\".concat(slug));\n\n  var _as = as || type && \"/\".concat(type).concat(slug !== '/' ? '/' + slug : '') || _href;\n\n  var isDesktop = useIsDesktop();\n\n  if (_href.indexOf('#') != -1) {\n    // anchor\n    var 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: function offset() {\n          return isDesktop ? 0 : 72;\n        },\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"}