Refactor components (WIP)

This commit is contained in:
2025-09-01 17:20:47 +02:00
parent 40cc2ef88b
commit 77d42a2c27
7 changed files with 214 additions and 165 deletions

View File

@@ -1,3 +1,4 @@
import Utils from "./utils.js";
/**
* @class Underwater
*/
@@ -34,8 +35,19 @@ export class Underwater {
</p>
</div>`;
}
/**
* @param {HTMLElement} imageContainer
* @param {Function} gallery
*/
setImages(imageContainer, gallery) {
if (this._data.images?.length) {
imageContainer.innerHTML = Utils.renderImages('underwater-gallery', this._data.images);
gallery('underwater-gallery', this._data.images);
} else
imageContainer.innerHTML = '<p class="has-text-centered">Nessuna risorsa visuale disponibile</p>';
}
async fetchData(url) {
return await fetch(url).then(res => res.json());
async renderDocs() {
return await Utils.generateDocsTable(this._data, 'underwater');
}
}