---
import { Icon } from "astro-icon/components";
import { AI_SUMMARY_PROMPT } from "../lib/constants";

interface Props {
    url: string; // anything that precedes the prompt: e.g. "https://ai.example.com/?prompt="
    title: string;
    icon: string;
    prompt?: string; // optional custom prompt, defaults to AI_SUMMARY_PROMPT
}

const { url, title, icon, prompt = AI_SUMMARY_PROMPT } = Astro.props;

const fullUrl = url + encodeURIComponent(prompt);
---

<a
  href={fullUrl}
  target="_blank"
  rel="noopener noreferrer"
  class="text-fg hover:text-[var(--ayu-accent)] transition-colors duration-150"
  title={title}
>
  <Icon name={icon} class="w-7 h-7" />
</a>
