"use client";

import { Megaphone } from "lucide-react";

export default function Marquee({ text, tahunAjaran }: { text: string; tahunAjaran: string }) {
  if (!text) return null;
  const item = `PPDB Tahun Ajaran ${tahunAjaran} — ${text}`;
  const repeated = Array(4).fill(item);
  return (
    <div className="relative overflow-hidden border-y border-[#D4A017]/30 bg-gradient-to-r from-[#5d1420] via-[#7B1E28] to-[#5d1420] py-2.5">
      <div className="animate-marquee flex w-max items-center gap-16 whitespace-nowrap">
        {repeated.map((t, i) => (
          <span key={i} className="flex items-center gap-3 text-sm font-medium text-yellow-100/95">
            <Megaphone className="size-4 text-[#D4A017]" />
            {t}
          </span>
        ))}
      </div>
    </div>
  );
}
