import { ReactNode } from "react";
import Link from "next/link";
import Title from "@/components/Title/Title";
import Cta from "@/components/Cta/Cta";
import ContactCta from "@/components/ContactCta/ContactCta";
import styles from "./TitleCta.module.css";

type TitleCtaProps = {
  title?: ReactNode;
  ctaLabel?: string;
  ctaHref?: string;
  color?: string;
  className?: string;
  titleSize?: "default" | "sm";
};

const TitleCta = ({
  title = "Let's Collaborate",
  ctaLabel = "Contact us",
  ctaHref,
  color = "white",
  className = "",
  titleSize = "default",
}: TitleCtaProps) => {
  const classes = [styles.titleCta, className].join(" ").trim();
  const titleClassName =
    titleSize === "sm" ? styles.titleTextSm : styles.titleText;

  return (
    <div className={classes}>
      <Title color={color} className={titleClassName}>
        {title}
      </Title>
      {ctaHref ? (
        <Link href={ctaHref} className={styles.ctaLink}>
          <Cta label={ctaLabel} />
        </Link>
      ) : (
        <ContactCta label={ctaLabel} />
      )}
    </div>
  );
};

export default TitleCta;
