Skip to content

Instantly share code, notes, and snippets.

@Klerith
Last active June 19, 2025 17:08
Show Gist options
  • Save Klerith/5bb4c217f7d253a4041ecda7f125254f to your computer and use it in GitHub Desktop.
Save Klerith/5bb4c217f7d253a4041ecda7f125254f to your computer and use it in GitHub Desktop.
Diseño de un componente tipo semáforo
export const TrafficLight = () => {
return (
<div className="min-h-screen bg-gradient-to-br from-slate-900 via-gray-900 to-slate-800 flex items-center justify-center p-4">
<div className="flex flex-col items-center space-y-8">
<div className="w-32 h-32 bg-red-500 rounded-full"></div>
<div className="w-32 h-32 bg-yellow-500 rounded-full"></div>
<div className="w-32 h-32 bg-green-500 rounded-full"></div>
{/* Botón para cambiar el estado de la luz */}
<div className="flex gap-2">
<button
className="bg-red-500 text-white px-4 py-2 rounded-md cursor-pointer">
Rojo
</button>
<button
className="bg-yellow-500 text-white px-4 py-2 rounded-md cursor-pointer">
Amarillo
</button>
<button
className="bg-green-500 text-white px-4 py-2 rounded-md cursor-pointer">
Verde
</button>
</div>
</div>
</div>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment