This commit is contained in:
Seth 2025-05-17 17:50:34 -04:00
parent b76e879350
commit 9a1564cdb5
10 changed files with 212 additions and 57 deletions

View file

@ -7,13 +7,22 @@ export default () => {
socket.addEventListener("hyperate", (event: Event) => {
const heartRate = (event as CustomEvent).detail;
if (heartRate === 0) {
document.body.style.setProperty("--hyperate-display", "none");
} else {
document.body.style.removeProperty("--hyperate-display");
}
document.body.style.setProperty("--bpm", heartRate.toString());
if (paragraph.current) {
paragraph.current.innerText = `${heartRate} BPM`;
paragraph.current.innerText = `❤️ ${heartRate} BPM`;
}
});
return (
<div>
<p ref={paragraph}>0 BPM</p>
<p class="heartbeat" ref={paragraph}> 0 BPM</p>
</div>
);
};