import Link from "next/link";

import { shortHash } from "@/lib/explorer-mock";
import { cn } from "@/lib/utils";

export function HashLink({
  href,
  hash,
  className,
  mono = true,
}: {
  href: string;
  hash: string;
  className?: string;
  mono?: boolean;
}) {
  return (
    <Link
      href={href}
      className={cn(
        "text-accent-hover hover:underline",
        mono && "font-mono text-[13px] tabular-nums",
        className,
      )}
      title={hash}
    >
      {shortHash(hash)}
    </Link>
  );
}
