"use client";
import React, { useState } from "react";
import { Input } from "@/components/ui/input";
import { Button } from "@/components/ui/button";

export default function JoinForm() {
  const [email, setEmail] = useState("");

  function handleSubmit(e: React.FormEvent) {
    e.preventDefault();
    // replace with real action (call API route or server action)
    alert(`Thanks — we'll ping ${email}`);
    setEmail("");
  }

  return (
    <form className="mt-4 flex gap-2" onSubmit={handleSubmit}>
      <Input
        value={email}
        onChange={(e: React.ChangeEvent<HTMLInputElement>) => setEmail(e.target.value)}
        placeholder="you@company.com"
        aria-label="Email"
      />
      <Button type="submit">Join</Button>
    </form>
  );
}
