import { Link } from "@tanstack/react-router";
import type { ReactNode } from "react";

/** Internal link to the product page in this webshop. */
export function ShopLink({ product, className, children }: { product?: string | undefined; source?: string; className?: string | undefined; children: ReactNode }) {
  if (!product) return <Link to="/shop" className={className}>{children}</Link>;
  return <Link to="/product/$slug" params={{ slug: product }} className={className}>{children}</Link>;
}
