'use client';

import Link from 'next/link'
import React from 'react'
import type { LinkProps } from 'next/link'
import clsx from 'clsx'

type Props = {
  icon: React.ReactElement
  value: string
} & LinkProps & React.AnchorHTMLAttributes<HTMLAnchorElement>

function BottomNavLink({ icon, value, href, prefetch, ...restProps }: Props) {
  const shouldPrefetch = prefetch ?? true;

  return (
    <Link {...restProps} href={href} prefetch={shouldPrefetch} className={clsx(
      'flex flex-col justify-arround items-center gap-[5px] pointer-events-auto min-w-0 text-primary **:stroke-primary',
      restProps.className ?? '',
    )}>
      <div className="shrink-0">
        {icon}
      </div>
      <span className="text-xs2 text-center truncate w-full">
        {value}
      </span>
    </Link>
  )
}

export default BottomNavLink
