From 437b8ba3d98705d60d5854322b9adb817d0519e7 Mon Sep 17 00:00:00 2001 From: Frank Tovar Date: Wed, 28 Jan 2026 16:06:19 +0100 Subject: [PATCH] Enhance cards: larger screenshots, lightbox, full-width styled vote slider --- wwwroot/app.js | 29 ++++++++++++++- wwwroot/index.html | 3 +- wwwroot/styles.css | 91 +++++++++++++++++++++++++++++++++++++++++----- 3 files changed, 110 insertions(+), 13 deletions(-) diff --git a/wwwroot/app.js b/wwwroot/app.js index 94c34b0..e30ba76 100644 --- a/wwwroot/app.js +++ b/wwwroot/app.js @@ -128,7 +128,7 @@ function renderVotes() { const footer = document.createElement("div"); footer.className = "vote-controls"; footer.innerHTML = ` - + ${current}`; li.querySelector(".card-body").appendChild(footer); list.appendChild(li); @@ -263,8 +263,11 @@ function buildCard(s, { showAuthor }) { const card = document.createElement("article"); card.className = "game-card"; const hasImage = !!s.screenshotUrl; + const visual = hasImage + ? `` + : `
`; card.innerHTML = ` -
+ ${visual}

${s.name}

@@ -275,9 +278,31 @@ function buildCard(s, { showAuthor }) { ${s.youtubeUrl ? `YouTube ↗` : ""}
`; + if (hasImage) { + const btn = card.querySelector(".card-visual"); + btn.addEventListener("click", () => openLightbox(s.screenshotUrl, s.name)); + } return card; } +function openLightbox(url, title) { + const overlay = document.createElement("div"); + overlay.className = "lightbox"; + overlay.innerHTML = ` + + `; + overlay.addEventListener("click", (e) => { + if (e.target.classList.contains("lightbox") || e.target.classList.contains("lightbox-close")) { + overlay.remove(); + } + }); + document.body.appendChild(overlay); +} + async function main() { setupHandlers(); try { diff --git a/wwwroot/index.html b/wwwroot/index.html index c4af251..82576ce 100644 --- a/wwwroot/index.html +++ b/wwwroot/index.html @@ -16,7 +16,7 @@