228 lines
12 KiB
JavaScript
228 lines
12 KiB
JavaScript
import React, { useState, useRef, useCallback } from "react";
|
|
|
|
/**
|
|
* SampleFullPageTemplate
|
|
*
|
|
* Componente de referencia completo que ejemplifica la implementación
|
|
* de los patrones de diseño, paleta de colores y arquitectura responsiva
|
|
* para el ecosistema CPIC - Conecta (SENA).
|
|
*/
|
|
export default function SampleFullPageTemplate() {
|
|
const [mobileMenuOpen, setMobileMenuOpen] = useState(false);
|
|
const [activeTab, setActiveTab] = useState(0);
|
|
const [isDarkMode, setIsDarkMode] = useState(true);
|
|
const mainRef = useRef(null);
|
|
|
|
const TABS = [
|
|
{ id: 'general', name: 'General', icon: 'fa-house' },
|
|
{ id: 'oferta', name: 'Oferta Académica', icon: 'fa-graduation-cap' },
|
|
{ id: 'metricas', name: 'Métricas', icon: 'fa-chart-pie' },
|
|
{ id: 'soporte', name: 'Soporte', icon: 'fa-headset' },
|
|
];
|
|
|
|
const toggleTheme = () => {
|
|
setIsDarkMode((prev) => {
|
|
const next = !prev;
|
|
if (next) {
|
|
document.documentElement.classList.add('dark');
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
} else {
|
|
document.documentElement.classList.remove('dark');
|
|
document.documentElement.setAttribute('data-theme', 'light');
|
|
}
|
|
return next;
|
|
});
|
|
};
|
|
|
|
return (
|
|
<div className="h-[100dvh] max-h-[100dvh] w-full flex flex-col md:flex-row relative z-10 overflow-hidden p-2 sm:p-3 gap-2 sm:gap-3">
|
|
{/* ── 1. Resplandor Ambiental de Fondo (Tier 1) ── */}
|
|
<div className="absolute inset-0 pointer-events-none overflow-hidden -z-10" aria-hidden="true">
|
|
<div className="absolute top-10 left-1/4 w-96 h-96 bg-lime-500/8 dark:bg-lime-500/10 rounded-full blur-[120px]" />
|
|
<div className="absolute bottom-20 right-1/4 w-96 h-96 bg-emerald-500/6 dark:bg-emerald-500/8 rounded-full blur-[140px]" />
|
|
</div>
|
|
|
|
{/* ── 2. Botón Hamburguesa Flotante para Móvil ── */}
|
|
<button
|
|
type="button"
|
|
onClick={() => setMobileMenuOpen(!mobileMenuOpen)}
|
|
className="md:hidden fixed top-3 left-3 z-40 w-10 h-10 rounded-xl bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 flex items-center justify-center text-gray-800 dark:text-white shadow-md cursor-pointer"
|
|
aria-label="Abrir menú"
|
|
>
|
|
<i className={`fa-solid ${mobileMenuOpen ? 'fa-xmark' : 'fa-bars'} text-sm`} />
|
|
</button>
|
|
|
|
{/* ── 3. Barra Lateral Principal (Desktop fija / Móvil Drawer) ── */}
|
|
<aside
|
|
className={`
|
|
fixed md:static inset-y-0 left-0 z-50
|
|
w-64 md:w-20 md:hover:w-64
|
|
transition-all duration-300 ease-in-out
|
|
flex flex-col justify-between p-3
|
|
bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl
|
|
border border-black/8 dark:border-white/10
|
|
rounded-r-3xl md:rounded-3xl
|
|
shadow-[0_8px_32px_rgba(0,0,0,0.15)]
|
|
${mobileMenuOpen ? 'translate-x-0' : '-translate-x-full md:translate-x-0'}
|
|
`}
|
|
>
|
|
{/* Cabecera Sidebar con Logo */}
|
|
<div className="flex items-center gap-3 px-2 py-1">
|
|
<div className="w-10 h-10 rounded-2xl bg-lime/15 border border-lime/30 flex items-center justify-center shrink-0">
|
|
<span className="font-extrabold text-[#39A900] dark:text-lime text-base">C</span>
|
|
</div>
|
|
<div className="min-w-0 overflow-hidden">
|
|
<h2 className="font-bold text-sm text-gray-900 dark:text-white truncate">CPIC Conecta</h2>
|
|
<p className="text-[10px] text-gray-400 dark:text-white/40 truncate">SENA Regional Caldas</p>
|
|
</div>
|
|
</div>
|
|
|
|
{/* Enlaces de Navegación */}
|
|
<nav className="flex-1 my-4 space-y-1.5 overflow-y-auto">
|
|
{TABS.map((tab, idx) => (
|
|
<button
|
|
key={tab.id}
|
|
onClick={() => { setActiveTab(idx); setMobileMenuOpen(false); }}
|
|
className={`w-full flex items-center gap-3 px-3 py-2.5 rounded-2xl text-xs font-semibold transition-all cursor-pointer ${
|
|
activeTab === idx
|
|
? 'bg-lime/15 text-lime-deep dark:text-lime border border-lime/30 shadow-[0_2px_12px_rgba(132,204,22,0.15)]'
|
|
: 'text-gray-600 dark:text-white/60 hover:bg-black/5 dark:hover:bg-white/5'
|
|
}`}
|
|
>
|
|
<i className={`fa-solid ${tab.icon} text-sm shrink-0`} />
|
|
<span className="truncate">{tab.name}</span>
|
|
</button>
|
|
))}
|
|
</nav>
|
|
|
|
{/* Pie de Sidebar con Alternador de Modo Oscuro */}
|
|
<div className="pt-2 border-t border-black/8 dark:border-white/8">
|
|
<button
|
|
type="button"
|
|
onClick={toggleTheme}
|
|
className="w-full flex items-center gap-3 px-3 py-2.5 rounded-2xl text-xs font-semibold text-gray-600 dark:text-white/60 hover:bg-black/5 dark:hover:bg-white/8 transition-colors cursor-pointer"
|
|
>
|
|
<i className={`fa-solid ${isDarkMode ? 'fa-sun text-amber-400' : 'fa-moon text-emerald-600'} text-sm shrink-0`} />
|
|
<span className="truncate">{isDarkMode ? 'Modo Claro' : 'Modo Oscuro'}</span>
|
|
</button>
|
|
</div>
|
|
</aside>
|
|
|
|
{/* Telón oscuro para Drawer en móvil */}
|
|
{mobileMenuOpen && (
|
|
<div
|
|
onClick={() => setMobileMenuOpen(false)}
|
|
className="fixed inset-0 bg-black/60 backdrop-blur-sm z-40 md:hidden"
|
|
/>
|
|
)}
|
|
|
|
{/* ── 4. Columna Central Principal (Tier 2 Glass) ── */}
|
|
<div className="flex-1 min-w-0 flex flex-col h-full overflow-hidden">
|
|
{/* Cabecera Móvil y Chips Deslizables */}
|
|
<div className="md:hidden shrink-0 flex flex-col gap-1.5 mb-1.5 z-20">
|
|
<div className="flex items-center justify-between px-3 py-2 bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-2xl pl-14">
|
|
<span className="font-bold text-xs text-gray-900 dark:text-white">
|
|
CPIC <span className="text-[#39A900] dark:text-lime">conecta</span>
|
|
</span>
|
|
<span className="px-2 py-0.5 rounded-md text-[10px] font-semibold bg-lime/15 text-lime-deep dark:text-lime border border-lime/25">
|
|
EN LÍNEA
|
|
</span>
|
|
</div>
|
|
|
|
<div
|
|
className="w-full overflow-x-auto flex items-center gap-1.5 py-1 px-1 bg-white/75 dark:bg-[rgba(10,22,10,0.75)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-2xl"
|
|
style={{ scrollbarWidth: 'none' }}
|
|
>
|
|
{TABS.map((tab, idx) => (
|
|
<button
|
|
key={tab.id}
|
|
onClick={() => setActiveTab(idx)}
|
|
className={`px-3 py-1.5 rounded-xl text-xs font-semibold whitespace-nowrap transition-all flex items-center gap-1.5 shrink-0 ${
|
|
activeTab === idx
|
|
? 'bg-lime text-black font-bold shadow-sm'
|
|
: 'text-gray-700 dark:text-white/70 hover:bg-black/5 dark:hover:bg-white/10'
|
|
}`}
|
|
>
|
|
<i className={`fa-solid ${tab.icon} text-[10px]`} />
|
|
<span>{tab.name}</span>
|
|
</button>
|
|
))}
|
|
</div>
|
|
</div>
|
|
|
|
{/* Tarjeta de Contenido Principal con Scroll Interno */}
|
|
<main
|
|
ref={mainRef}
|
|
className="flex-1 overflow-y-auto p-4 sm:p-6 lg:p-8 custom-scrollbar bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-2xl md:rounded-3xl shadow-[0_8px_32px_rgba(0,0,0,0.1)] flex flex-col gap-6"
|
|
>
|
|
{/* Título y Subtítulo */}
|
|
<div>
|
|
<div className="inline-flex items-center gap-2 px-3 py-1 rounded-full bg-lime/10 border border-lime/20 text-[#39A900] dark:text-lime text-xs font-bold mb-2">
|
|
<span className="w-2 h-2 rounded-full bg-lime animate-pulse" />
|
|
SENA - Centro de Procesos Industriales y Construcción
|
|
</div>
|
|
<h1 className="text-2xl sm:text-4xl font-black text-gray-900 dark:text-white tracking-tight">
|
|
Ecosistema Virtual <span className="text-[#39A900] dark:text-lime">Conecta</span>
|
|
</h1>
|
|
<p className="text-xs sm:text-sm text-gray-600 dark:text-white/70 mt-1 max-w-2xl leading-relaxed">
|
|
Diseño unificado responsivo en 3 capas de cristal con verde institucional y soporte universal.
|
|
</p>
|
|
</div>
|
|
|
|
{/* Rejilla de Módulos (Auto-fit Grid) */}
|
|
<div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-3 sm:gap-4">
|
|
{[
|
|
{ title: 'Chat con IA y RAG', desc: 'Respuestas contextuales con modelos multi-proveedor.', icon: 'fa-brain' },
|
|
{ title: 'Lengua de Señas (LSC)', desc: 'Dock interpretativo sincronizado para inclusión auditiva.', icon: 'fa-hands-asl-interpreting' },
|
|
{ title: 'Gestión Institucional', desc: 'Administración de roles, embeddings y métricas en tiempo real.', icon: 'fa-cubes' },
|
|
].map((card, idx) => (
|
|
<div
|
|
key={idx}
|
|
className="p-5 rounded-2xl bg-white/60 dark:bg-white/[0.04] border border-black/8 dark:border-white/10 backdrop-blur-xl shadow-sm hover:scale-[1.01] hover:border-lime/30 transition-all flex flex-col justify-between"
|
|
>
|
|
<div>
|
|
<div className="w-10 h-10 rounded-xl bg-lime/15 border border-lime/25 flex items-center justify-center text-[#39A900] dark:text-lime mb-3">
|
|
<i className={`fa-solid ${card.icon} text-base`} />
|
|
</div>
|
|
<h3 className="font-bold text-sm text-gray-900 dark:text-white">{card.title}</h3>
|
|
<p className="text-xs text-gray-500 dark:text-white/60 mt-1 leading-normal">{card.desc}</p>
|
|
</div>
|
|
<div className="mt-4 pt-3 border-t border-black/6 dark:border-white/8 flex items-center justify-between text-xs">
|
|
<span className="text-[#39A900] dark:text-lime font-bold">Explorar</span>
|
|
<i className="fa-solid fa-arrow-right text-gray-400 group-hover:translate-x-1 transition-transform" />
|
|
</div>
|
|
</div>
|
|
))}
|
|
</div>
|
|
</main>
|
|
</div>
|
|
|
|
{/* ── 5. Barra Lateral Derecha (RightSidebar) ── */}
|
|
<aside className="hidden md:flex md:flex-col md:w-14 lg:w-16 md:shrink-0 md:justify-between p-2 bg-white/85 dark:bg-[rgba(10,22,10,0.85)] backdrop-blur-2xl border border-black/8 dark:border-white/10 rounded-3xl shadow-[0_8px_32px_rgba(0,0,0,0.12)]">
|
|
<div className="flex flex-col items-center gap-2">
|
|
<div className="w-9 h-9 rounded-2xl bg-lime/15 border border-lime/30 flex items-center justify-center text-lime-deep dark:text-lime font-black text-xs">
|
|
CPIC
|
|
</div>
|
|
</div>
|
|
|
|
<div className="flex flex-col items-center gap-3">
|
|
<button
|
|
type="button"
|
|
className="w-9 h-9 rounded-2xl hover:bg-black/5 dark:hover:bg-white/10 flex items-center justify-center text-gray-600 dark:text-white/70 transition-colors"
|
|
title="Accesibilidad"
|
|
>
|
|
<i className="fa-solid fa-universal-access text-sm" />
|
|
</button>
|
|
<button
|
|
type="button"
|
|
className="w-9 h-9 rounded-2xl bg-lime text-black flex items-center justify-center shadow-md hover:scale-105 active:scale-95 transition-all"
|
|
title="Asistente Virtual"
|
|
>
|
|
<i className="fa-solid fa-comment-dots text-sm" />
|
|
</button>
|
|
</div>
|
|
</aside>
|
|
</div>
|
|
);
|
|
}
|