Refactor components (WIP)
This commit is contained in:
@@ -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');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user