import React from "react";
import { motion } from "framer-motion";
interface ShipSelectorProps {
remainingShips: string[]; // ex: ["carrier", "battleship", ...]
selectedShip: string | null;
orientation: "h" | "v";
onSelectShip: (ship: string) => void;
onToggleOrientation: () => void;
}
export default function ShipSelector({
remainingShips,
selectedShip,
orientation,
onSelectShip,
onToggleOrientation,
}: ShipSelectorProps) {
return (
Select ship & orientation
{/* SHIP BUTTONS */}
{remainingShips.map((ship) => {
const active = ship === selectedShip;
return (
onSelectShip(ship)}
whileHover={{ scale: 1.05 }}
whileTap={{ scale: 0.92 }}
style={{
padding: "8px 14px",
borderRadius: 8,
background: active ? "#f1c40f" : "#333",
color: active ? "#000" : "#fff",
border: "2px solid #444",
cursor: "pointer",
fontSize: 14,
}}
>
{ship.toUpperCase()}
);
})}
{/* ORIENTATION BUTTON */}
Orientation: {orientation === "h" ? "Horizontal" : "Vertical"}
);
}