54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			54 lines
		
	
	
		
			1.6 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import Utils from "./utils.js";
 | |
| /**
 | |
|  * @class Underwater
 | |
|  */
 | |
| export class Underwater {
 | |
|     
 | |
|     /**
 | |
|      * @param {object} data
 | |
|      */
 | |
|     set data(data) {
 | |
|         this._data = data;
 | |
|     }
 | |
| 
 | |
|     async render() {
 | |
|         return `
 | |
|         <div class="container px-4 pt-4">
 | |
|             <p class="p-2">
 | |
|                 <strong>Denominazione:</strong> ${this._data.denomination}
 | |
|             </p>
 | |
|             <p class="p-2">
 | |
|                 <strong>Località generica:</strong> ${this._data.genericPlace}
 | |
|             </p>
 | |
|             <p class="p-2">
 | |
|                 <strong>Periodo:</strong> ${this._data.period}
 | |
|             </p>
 | |
|             <p class="p-2">
 | |
|                 <strong>Stato di conservazione:</strong> ${this._data.conservationState}
 | |
|             </p>
 | |
|             <p class="mt-4 pl-2 pr-5">
 | |
|                 <strong class="pb-3">Descrizione breve</strong></br>
 | |
|                 ${Utils.parseMarkers(this._data.shortDescription)}
 | |
|             </p>
 | |
|             <p class="p-2 mb-4">
 | |
|                 <strong>Autore scheda:</strong> ${this._data.author}
 | |
|             </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 renderDocs() {
 | |
|         return await Utils.generateDocsTable(this._data, 'underwater');
 | |
|     }
 | |
| }
 |