Skip to content

Commit

Permalink
🎨 Nota del umbral
Browse files Browse the repository at this point in the history
  • Loading branch information
1cgonza committed Dec 12, 2023
1 parent 49e75c1 commit 66be073
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion aplicaciones/www/src/componentes/Linea.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export default class Linea {
punto.onmouseenter = (evento) => {
const x = evento.pageX;
const y = evento.pageY;
informacion.innerText = `${nombre}: ${valor} ${unidad.toLocaleLowerCase() === 'porcentaje' ? '%' : ''}`;
informacion.innerText = `${nombre}: ${valor}${unidad.toLocaleLowerCase() === 'porcentaje' ? '%' : ''}`;
informacion.classList.add('visible');

Object.assign(informacion.style, {
Expand Down
26 changes: 25 additions & 1 deletion aplicaciones/www/src/componentes/LineaTiempo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const { alto, meta, umbral } = Astro.props;
const nombreEjeY = svg.querySelector<SVGTextElement>('#nombreEjeY');
const lineas: Linea[] = [];
const visualizaciones = document.getElementById('visualizaciones');

const informacion = document.getElementById('informacion') as HTMLDivElement;
const proporciones = { porcentaje: { x1: 2, x2: 95 }, pixeles: { x1: 0, x2: 0 } };
const años = { primero: 0, ultimo: 0 };
let cantidadDivisiones = 5;
Expand Down Expand Up @@ -189,6 +189,30 @@ const { alto, meta, umbral } = Astro.props;
areaUmbral.setAttribute('width', '100%');
areaUmbral.setAttribute('height', `${alto}`);
contenedorEjeY.appendChild(areaUmbral);

areaUmbral.onmouseenter = (evento) => {
const x = evento.pageX;
const y = evento.pageY;
informacion.innerText = `La meta es: ${umbral}`;
informacion.classList.add(...['visible', 'esUmbral']);
Object.assign(informacion.style, {
top: `${y}px`,
left: `${x}px`,
});
};

areaUmbral.onmousemove = (evento) => {
const x = evento.pageX;
const y = evento.pageY;
Object.assign(informacion.style, {
top: `${y}px`,
left: `${x}px`,
});
};

areaUmbral.onmouseleave = () => {
informacion.classList.remove(...['visible', 'esUmbral']);
};
}

for (let i = 0; i <= cantidadDivisiones; i++) {
Expand Down
6 changes: 6 additions & 0 deletions aplicaciones/www/src/scss/estilos.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
// Fondos
--moradoProfundo: #760287;
--moradoPandito: #faf2fc;
--verdeUmbral: rgba(76, 166, 88, 0.9);
}

html {
Expand Down Expand Up @@ -144,6 +145,11 @@ main {
&.visible {
opacity: 1;
}

&.esUmbral {
background-color: var(--verdeUmbral);
color: var(--blancoMarfil);
}
}

#comparativo {
Expand Down

0 comments on commit 66be073

Please sign in to comment.