Feat: Mapa Styles
This commit is contained in:
		| @@ -8,7 +8,7 @@ | ||||
| } | ||||
|  | ||||
| .panelNacionalContainer { | ||||
|   max-width: 1200px; | ||||
|   max-width: 900px; | ||||
|   margin: auto; | ||||
|   border: 1px solid #e0e0e0; | ||||
|   border-radius: 8px; | ||||
| @@ -151,9 +151,9 @@ | ||||
| .resultadosColumn { | ||||
|   flex: 1; | ||||
|   overflow-y: auto; | ||||
|   padding: 1.25rem; | ||||
|   padding: 1rem; | ||||
|   transition: all 0.5s ease-in-out; | ||||
|   min-width: 320px; | ||||
|   min-width: 350px; | ||||
| } | ||||
|  | ||||
| .partidoFila { | ||||
| @@ -186,14 +186,55 @@ | ||||
|   grid-template-columns: 1fr auto; | ||||
|   grid-template-rows: auto auto; | ||||
|   align-items: center; | ||||
|   gap: 0.25rem 0.75rem; | ||||
|   gap: 0.5rem 0.75rem; /* Aumentamos el gap vertical para más aire */ | ||||
| } | ||||
|  | ||||
| /* El contenedor de la barra */ | ||||
| .partidoBarraConVotos { | ||||
|   grid-column: 1 / 3; | ||||
|   position: relative; /* Clave para superponer el texto */ | ||||
|   height: 28px; | ||||
|   background-color: #f0f0f0; | ||||
|   border-radius: 6px; | ||||
| } | ||||
|  | ||||
| /* La barra de progreso coloreada */ | ||||
| .partidoBarraForeground { | ||||
|   height: 100%; | ||||
|   border-radius: 6px; | ||||
|   transition: width 0.5s ease-in-out; | ||||
| } | ||||
|  | ||||
| /* La ÚNICA capa de texto, posicionada de forma absoluta */ | ||||
| .partidoVotosEnBarra { | ||||
|   position: absolute; | ||||
|   top: 0; | ||||
|   right: 10px; | ||||
|   bottom: 0; | ||||
|   display: flex; | ||||
|   align-items: center; | ||||
|   font-size: 0.95rem; | ||||
|   font-weight: 600; | ||||
|   white-space: nowrap; | ||||
|   pointer-events: none; | ||||
|   color: #000; | ||||
| } | ||||
|  | ||||
| .animatedNumberWrapper { | ||||
|   margin-right: 4px; | ||||
| } | ||||
|  | ||||
| .partidoTopRow { display: contents; } | ||||
| .partidoInfoWrapper { min-width: 0; text-align: left; } | ||||
| .partidoInfoWrapper { | ||||
|   display: flex; | ||||
|   flex-direction: column; | ||||
|   justify-content: center; | ||||
|   min-width: 0; | ||||
|   text-align: left; | ||||
| } | ||||
|  | ||||
| .partidoNombre { | ||||
|   font-weight: 700; | ||||
|   font-weight: 600; | ||||
|   font-size: 1rem; | ||||
|   color: #212529; | ||||
|   white-space: nowrap; | ||||
| @@ -203,7 +244,7 @@ | ||||
| } | ||||
|  | ||||
| .partidoNombreNormal { | ||||
|   font-size: 1rem; | ||||
|   font-size: 0.9rem; | ||||
|   color: #212529; | ||||
|   white-space: nowrap; | ||||
|   overflow: hidden; | ||||
| @@ -212,18 +253,16 @@ | ||||
| } | ||||
|  | ||||
| .candidatoNombre { | ||||
|   font-size: 0.75rem; | ||||
|   color: #6c757d; | ||||
|   font-weight: 500; | ||||
|   font-size: 1rem; | ||||
|   font-weight: 600; | ||||
|   line-height: 1.1; | ||||
| } | ||||
|  | ||||
| .partidoStats { flex-shrink: 0; text-align: right; padding-left: 1rem; } | ||||
| .partidoPorcentaje { font-size: 1.35rem; font-weight: 700; display: block; } | ||||
| .partidoVotos { font-size: 0.9rem; color: #666; display: block; } | ||||
| .partidoPorcentaje { font-size: 1.15rem; font-weight: 700; display: block; } | ||||
|  | ||||
| .partidoBarraBackground { | ||||
|   height: 12px; | ||||
|   height: 16px; | ||||
|   background-color: #f0f0f0; | ||||
|   border-radius: 4px; | ||||
|   grid-column: 1 / 3; | ||||
|   | ||||
| @@ -55,7 +55,7 @@ interface MapaNacionalProps { | ||||
|   isMobileView: boolean; | ||||
| } | ||||
|  | ||||
| const desktopProjectionConfig = { scale: 700, center: [-65, -40] as [number, number] }; | ||||
| const desktopProjectionConfig = { scale: 1000, center: [-65, -40] as [number, number] }; | ||||
| const mobileProjectionConfig = { scale: 1000, center: [-64, -43] as [number, number] }; | ||||
| const mobileSmallProjectionConfig = { scale: 750, center: [-64, -45] as [number, number] }; | ||||
|  | ||||
|   | ||||
| @@ -5,7 +5,6 @@ import { assetBaseUrl } from '../../../../apiService'; | ||||
| import { AnimatedNumber } from './AnimatedNumber'; | ||||
| import { CircularProgressbar, buildStyles } from 'react-circular-progressbar'; | ||||
| import 'react-circular-progressbar/dist/styles.css'; | ||||
| // 1. Importamos el archivo de estilos como un módulo CSS | ||||
| import styles from '../PanelNacional.module.css'; | ||||
|  | ||||
| const formatPercent = (num: number) => `${(num || 0).toFixed(2).replace('.', ',')}%`; | ||||
| @@ -32,24 +31,18 @@ interface PanelResultadosProps { | ||||
| } | ||||
|  | ||||
| export const PanelResultados = ({ resultados, estadoRecuento }: PanelResultadosProps) => { | ||||
|   // 2. Todas las props 'className' ahora usan el objeto 'styles' | ||||
|   return ( | ||||
|     <div className={styles.panelResultados}> | ||||
|       <SvgDefs /> | ||||
|       <div className={styles.panelEstadoRecuento}> | ||||
|         {/* ... (Contenido de CircularProgressbar sin cambios) ... */} | ||||
|         <div className={styles.estadoItem}> | ||||
|           <CircularProgressbar | ||||
|             value={estadoRecuento.participacionPorcentaje} | ||||
|             text={formatPercent(estadoRecuento.participacionPorcentaje)} | ||||
|             strokeWidth={12} | ||||
|             circleRatio={0.75} | ||||
|             styles={buildStyles({ | ||||
|               textColor: '#333', | ||||
|               pathColor: 'url(#participationGradient)', | ||||
|               trailColor: '#e9ecef', | ||||
|               textSize: '22px', | ||||
|               rotation: 0.625, | ||||
|             })} | ||||
|             styles={buildStyles({ textColor: '#333', pathColor: 'url(#participationGradient)', trailColor: '#e9ecef', textSize: '22px', rotation: 0.625, })} | ||||
|           /> | ||||
|           <span>Participación</span> | ||||
|         </div> | ||||
| @@ -59,13 +52,7 @@ export const PanelResultados = ({ resultados, estadoRecuento }: PanelResultadosP | ||||
|             text={formatPercent(estadoRecuento.mesasTotalizadasPorcentaje)} | ||||
|             strokeWidth={12} | ||||
|             circleRatio={0.75} | ||||
|             styles={buildStyles({ | ||||
|               textColor: '#333', | ||||
|               pathColor: 'url(#scrutinizedGradient)', | ||||
|               trailColor: '#e9ecef', | ||||
|               textSize: '22px', | ||||
|               rotation: 0.625, | ||||
|             })} | ||||
|             styles={buildStyles({ textColor: '#333', pathColor: 'url(#scrutinizedGradient)', trailColor: '#e9ecef', textSize: '22px', rotation: 0.625, })} | ||||
|           /> | ||||
|           <span>Escrutado</span> | ||||
|         </div> | ||||
| @@ -73,11 +60,7 @@ export const PanelResultados = ({ resultados, estadoRecuento }: PanelResultadosP | ||||
|  | ||||
|       <div className={styles.panelPartidosContainer}> | ||||
|         {resultados.map(partido => ( | ||||
|           <div | ||||
|             key={partido.id} | ||||
|             className={styles.partidoFila} | ||||
|             style={{ borderLeftColor: partido.color || '#ccc' }} | ||||
|           > | ||||
|           <div key={partido.id} className={styles.partidoFila} style={{ borderLeftColor: partido.color || '#ccc' }}> | ||||
|             <div className={styles.partidoLogo} style={{ backgroundColor: partido.color || '#e9ecef' }}> | ||||
|               <ImageWithFallback src={partido.logoUrl || undefined} fallbackSrc={`${assetBaseUrl}/default-avatar.png`} alt={partido.nombre} /> | ||||
|             </div> | ||||
| @@ -97,13 +80,21 @@ export const PanelResultados = ({ resultados, estadoRecuento }: PanelResultadosP | ||||
|                   <span className={styles.partidoPorcentaje}> | ||||
|                     <AnimatedNumber value={partido.porcentaje} formatter={formatPercent} /> | ||||
|                   </span> | ||||
|                   <span className={styles.partidoVotos}> | ||||
|                     <AnimatedNumber value={partido.votos} formatter={formatVotes} /> votos | ||||
|                   </span> | ||||
|                 </div> | ||||
|               </div> | ||||
|               <div className={styles.partidoBarraBackground}> | ||||
|                 <div className={styles.partidoBarraForeground} style={{ width: `${partido.porcentaje}%`, backgroundColor: partido.color || '#888' }} /> | ||||
|  | ||||
|               <div className={styles.partidoBarraConVotos}> | ||||
|                 <div | ||||
|                   className={styles.partidoBarraForeground} | ||||
|                   style={{ width: `${partido.porcentaje}%`, backgroundColor: partido.color || '#888' }} | ||||
|                 /> | ||||
|                 <span className={styles.partidoVotosEnBarra}> | ||||
|                   <span className={styles.animatedNumberWrapper}> | ||||
|                     <AnimatedNumber value={partido.votos} formatter={formatVotes} /> | ||||
|                   </span> | ||||
|                   Votos | ||||
|                 </span> | ||||
|  | ||||
|               </div> | ||||
|             </div> | ||||
|           </div> | ||||
|   | ||||
| @@ -1,20 +1,24 @@ | ||||
| // src/features/legislativas/nacionales/components/PanelResultadosSkeleton.tsx | ||||
|  | ||||
| // 1. Importamos el archivo de estilos como un módulo CSS | ||||
| import styles from '../PanelNacional.module.css'; | ||||
|  | ||||
| // 2. Todas las props 'className' ahora usan el objeto 'styles' | ||||
| const SkeletonRow = () => ( | ||||
|   <div className={`${styles.partidoFila} ${styles.skeletonFila}`}> | ||||
|     <div className={styles.skeletonLogo} /> | ||||
|     <div className={styles.partidoInfoWrapper}> | ||||
|       <div className={styles.skeletonText} style={{ width: '60%' }} /> | ||||
|       <div className={styles.skeletonText} style={{ width: '40%', marginTop: '4px' }} /> | ||||
|       <div className={styles.skeletonBar} /> | ||||
|     </div> | ||||
|     <div className={styles.partidoStats}> | ||||
|       <div className={styles.skeletonText} style={{ width: '70%', marginBottom: '4px' }} /> | ||||
|       <div className={styles.skeletonText} style={{ width: '50%' }} /> | ||||
|     <div className={styles.partidoMainContent}> | ||||
|       {/* Fila Superior (Nombre y Porcentaje) */} | ||||
|       <div className={styles.partidoInfoWrapper}> | ||||
|         <div className={styles.skeletonText} style={{ width: '70%' }} /> | ||||
|         <div className={styles.skeletonText} style={{ width: '50%', marginTop: '4px' }} /> | ||||
|       </div> | ||||
|       <div className={styles.partidoStats}> | ||||
|         <div className={styles.skeletonText} style={{ width: '80px' }} /> | ||||
|       </div> | ||||
|  | ||||
|       {/* --- CAMBIO: La barra ahora es más alta y no hay texto de votos debajo --- */} | ||||
|       <div  | ||||
|         className={styles.skeletonBar}  | ||||
|         style={{ gridColumn: '1 / 3', height: '28px' }}  | ||||
|       /> | ||||
|     </div> | ||||
|   </div> | ||||
| ); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user