"use client"; import { useState } from "react"; import "./Selection.css"; function SelectionCo({ plataformasInscritas = [], onSelect, }: { plataformasInscritas: string[]; onSelect: (plataforma: string | null) => void; }) { const [selected, setSelected] = useState(null); const options = [ { name: "WINDOWS", img: "/windows.png", }, { name: "MACINTOSH", img: "apple.png", }, { name: "PROFESORES", img: "teacher.png", }, ]; const opcionesInscritas = options.filter((option) => plataformasInscritas.includes(option.name), ); const handleSelect = (optionName: string) => { const value = selected === optionName ? null : optionName; setSelected(value); onSelect(value); }; return (
{opcionesInscritas.map((option, index) => (
handleSelect(option.name)} > {option.name}
))} {opcionesInscritas.length === 0 && (

El alumno no está inscrito en ninguna plataforma

)}
); } export default SelectionCo;