2026-01-22 10:26:15 -06:00
|
|
|
"use client";
|
2025-09-02 19:50:17 -04:00
|
|
|
|
|
|
|
|
import { useState } from "react";
|
|
|
|
|
import "./Selection.css";
|
|
|
|
|
|
2026-01-22 10:26:15 -06:00
|
|
|
function Selection({
|
|
|
|
|
plataformasInscritas = [],
|
2026-01-22 10:53:07 -06:00
|
|
|
onSelect,
|
2026-01-22 10:26:15 -06:00
|
|
|
}: {
|
|
|
|
|
plataformasInscritas: string[];
|
2026-01-22 10:53:07 -06:00
|
|
|
onSelect: (plataforma: string | null) => void;
|
2026-01-22 10:26:15 -06:00
|
|
|
}) {
|
2025-09-02 19:50:17 -04:00
|
|
|
const [selected, setSelected] = useState<string | null>(null);
|
|
|
|
|
|
2026-01-22 10:53:07 -06:00
|
|
|
const handleSelect = (optionName: string) => {
|
|
|
|
|
const value = selected === optionName ? null : optionName;
|
|
|
|
|
setSelected(value);
|
|
|
|
|
onSelect(value);
|
|
|
|
|
};
|
2025-09-02 19:50:17 -04:00
|
|
|
const options = [
|
|
|
|
|
{
|
|
|
|
|
name: "WINDOWS",
|
2026-01-23 19:34:03 -06:00
|
|
|
img: "/windows.png",
|
2025-09-02 19:50:17 -04:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "MACINTOSH",
|
2026-01-23 19:34:03 -06:00
|
|
|
img: "apple.png",
|
2025-09-02 19:50:17 -04:00
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
name: "PROFESORES",
|
2026-01-23 19:34:03 -06:00
|
|
|
img: "teacher.png",
|
2025-09-02 19:50:17 -04:00
|
|
|
},
|
|
|
|
|
];
|
|
|
|
|
|
2026-01-22 10:26:15 -06:00
|
|
|
const opcionesDisponibles = options.filter(
|
|
|
|
|
(option) => !plataformasInscritas.includes(option.name),
|
|
|
|
|
);
|
|
|
|
|
|
2025-09-02 19:50:17 -04:00
|
|
|
return (
|
|
|
|
|
<section className="selection">
|
2026-01-22 10:26:15 -06:00
|
|
|
{opcionesDisponibles.map((option, index) => (
|
2025-09-02 19:50:17 -04:00
|
|
|
<div
|
|
|
|
|
key={index}
|
|
|
|
|
className="selectionItem"
|
|
|
|
|
onClick={() => handleSelect(option.name)}
|
|
|
|
|
>
|
|
|
|
|
<button
|
2026-01-22 10:26:15 -06:00
|
|
|
className={`buttonSelection ${
|
|
|
|
|
selected === option.name ? "active" : ""
|
|
|
|
|
}`}
|
2025-09-02 19:50:17 -04:00
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
src={option.img}
|
|
|
|
|
alt={option.name.toLowerCase()}
|
|
|
|
|
height={30}
|
|
|
|
|
width={30}
|
|
|
|
|
/>
|
|
|
|
|
</button>
|
|
|
|
|
<span className="buttonLabel">{option.name}</span>
|
|
|
|
|
</div>
|
|
|
|
|
))}
|
2026-01-22 10:26:15 -06:00
|
|
|
|
|
|
|
|
{opcionesDisponibles.length === 0 && (
|
|
|
|
|
<p style={{ opacity: 0.6 }}>
|
|
|
|
|
El alumno ya está inscrito en todas las plataformas
|
|
|
|
|
</p>
|
|
|
|
|
)}
|
2025-09-02 19:50:17 -04:00
|
|
|
</section>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export default Selection;
|