mirror of
https://github.com/Queer-Lexikon/regenbogenkarte
synced 2024-11-22 12:13:07 +00:00
20 lines
569 B
TypeScript
20 lines
569 B
TypeScript
|
import { LEGEND_MAPPING } from "./config";
|
||
|
|
||
|
export const setupLegend = () => {
|
||
|
const template = <HTMLTemplateElement>document.getElementById("legend-list-entry");
|
||
|
const lists = document.querySelectorAll<HTMLElement>("[data-id=legend-list]");
|
||
|
|
||
|
lists.forEach((l) => {
|
||
|
for (const [_, [icon, text]] of LEGEND_MAPPING) {
|
||
|
const copy = <HTMLElement>template.content.cloneNode(true);
|
||
|
const img = copy.querySelector("img")!;
|
||
|
img.src = icon;
|
||
|
|
||
|
const description = copy.querySelector("span")!;
|
||
|
description.innerText = text;
|
||
|
|
||
|
l.appendChild(copy);
|
||
|
}
|
||
|
});
|
||
|
};
|