Gear list styling
This commit is contained in:
parent
4b4b91a30a
commit
4940c3703f
4 changed files with 57 additions and 1 deletions
|
|
@ -32,12 +32,14 @@ async function getGearList() {
|
|||
function gearToElement(gear, group) {
|
||||
let li = document.createElement("li");
|
||||
li.setAttribute("id", `gl-${group}-${gear.id}`);
|
||||
li.setAttribute("class", "gl-item");
|
||||
let heading = document.createElement("h3");
|
||||
heading.setAttribute("class", "gl-item-name");
|
||||
heading.textContent = gear.name;
|
||||
li.appendChild(heading);
|
||||
let description = document.createElement("p");
|
||||
description.setAttribute("class", "gl-item-desc");
|
||||
description.textContent = gear.desc;
|
||||
li.appendChild(description);
|
||||
return li;
|
||||
}
|
||||
|
|
@ -61,6 +63,7 @@ function gearListToList(gear) {
|
|||
function bondageItemsToUl(items) {
|
||||
let ul = document.createElement("ul");
|
||||
ul.setAttribute("id", `gl-${items.id}-list`);
|
||||
ul.setAttribute("class", "gl-item-list");
|
||||
for (const i of gearListToList(items)) {
|
||||
ul.appendChild(i);
|
||||
}
|
||||
|
|
@ -80,9 +83,17 @@ async function generateGearListArticle(position) {
|
|||
heading.textContent = "Gear List";
|
||||
bondageItems.appendChild(heading);
|
||||
|
||||
let divider = document.createElement("hr");
|
||||
divider.setAttribute("class", "gl-divider");
|
||||
bondageItems.appendChild(divider);
|
||||
|
||||
for (const section of Object.values(list)) {
|
||||
let listSection = buildSection(section);
|
||||
bondageItems.appendChild(listSection);
|
||||
|
||||
let divider = document.createElement("hr");
|
||||
divider.setAttribute("class", "gl-divider");
|
||||
bondageItems.appendChild(divider);
|
||||
}
|
||||
|
||||
return bondageItems;
|
||||
|
|
@ -112,5 +123,5 @@ function buildSection(items) {
|
|||
export async function attachGearList(position) {
|
||||
document
|
||||
.getElementById(position)
|
||||
.replaceWith(await generateGearListArticle(position));
|
||||
?.replaceWith(await generateGearListArticle(position));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue