import NextLink from 'next/link'

/**
 * The `Link` component is used to render Next.js links with customizable properties such as `children`, `scroll`, and `className`.
 *
 * @param {Object} props - Props passed to the `Link` component.
 * @param {ReactNode} props.children - Child elements to be rendered as link content.
 * @param {string} props.className - Additional CSS class to be applied to the link.
 * @returns {JSX.Element} - Rendered `Link` component.
 */
const Link = ({ children, ...props }) => {
  if (!props?.href || props?.href == false) return children

  return (
    <NextLink
      {...props}
      scroll={false}
      className={`block font-medium text-danger-500 ${props?.className || ''}`}
    >
      {children}
    </NextLink>
  )
}

Link.defaultProps = NextLink.defaultProps

export default Link
