import {Gender} from "@/interfaces/user";
import {RadioGroup} from "@headlessui/react";
import clsx from "clsx";

interface Props {
	value?: Gender;
	onChange: (value?: Gender) => void;
}

export default function GenderInput({value, onChange}: Props) {
	return (
		<div className="relative flex flex-col gap-3 w-full">
			<label className="font-normal text-base text-mti-gray-dim">Gender *</label>
			<RadioGroup value={value} onChange={onChange} className="flex flex-row gap-4 justify-between">
				<RadioGroup.Option value="male">
					{({checked}) => (
						<span
							className={clsx(
								"px-6 py-4 w-28 flex justify-center text-sm font-normal rounded-full border focus:outline-none cursor-pointer",
								"transition duration-300 ease-in-out",
								!checked ? "bg-white border-mti-gray-platinum" : "bg-mti-purple-light border-mti-purple-dark text-white",
							)}>
							Male
						</span>
					)}
				</RadioGroup.Option>
				<RadioGroup.Option value="female">
					{({checked}) => (
						<span
							className={clsx(
								"px-6 py-4 w-28 flex justify-center text-sm font-normal rounded-full border focus:outline-none cursor-pointer",
								"transition duration-300 ease-in-out",
								!checked ? "bg-white border-mti-gray-platinum" : "bg-mti-purple-light border-mti-purple-dark text-white",
							)}>
							Female
						</span>
					)}
				</RadioGroup.Option>
				<RadioGroup.Option value="other">
					{({checked}) => (
						<span
							className={clsx(
								"px-6 py-4 w-28 flex justify-center text-sm font-normal rounded-full border focus:outline-none cursor-pointer",
								"transition duration-300 ease-in-out",
								!checked ? "bg-white border-mti-gray-platinum" : "bg-mti-purple-light border-mti-purple-dark text-white",
							)}>
							Other
						</span>
					)}
				</RadioGroup.Option>
			</RadioGroup>
		</div>
	);
}
