chore(aiteam): finalize tested changes for review

This commit is contained in:
AiTeam Coding Agent
2026-08-01 17:18:10 +00:00
parent d3297a70fb
commit 1919f892ec
6 changed files with 212 additions and 0 deletions

46
quiz/app.js Normal file
View File

@@ -0,0 +1,46 @@
"use strict";
const categories = [
{ name: "Wrestling", icon: "assets/icons/wrestling.svg" },
{ name: "Film", icon: "assets/icons/film.svg" },
{ name: "Technik", icon: "assets/icons/technik.svg" },
];
const appContainer = document.getElementById("categories");
const statusRegion = document.getElementById("status");
function buildTile(category) {
const button = document.createElement("button");
button.type = "button";
button.className = "tile";
button.dataset.category = category.name;
const img = document.createElement("img");
img.src = category.icon;
img.alt = "";
img.width = 48;
img.height = 48;
const label = document.createElement("span");
label.className = "tile-label";
label.textContent = category.name;
button.append(img, label);
button.addEventListener("click", () => {
statusRegion.textContent = "Kategorie gewählt: " + category.name;
});
return button;
}
document.addEventListener("DOMContentLoaded", () => {
const tilesContainer = appContainer.querySelector(".tiles");
const fragment = document.createDocumentFragment();
categories.forEach((category) => {
fragment.appendChild(buildTile(category));
});
tilesContainer.appendChild(fragment);
});