@salla.sa/twilight-components
Version:
Salla Web Component
5 lines • 1.79 kB
JavaScript
/*!
* Crafted with ❤ by Salla
*/
import{r as registerInstance,h,H as Host,g as getElement}from"./index-114c614f.js";var sallaAppsIconsCss=":host{display:block}";var SallaAppsIcons=function(){function e(e){var t=this;registerInstance(this,e);var s;this.apps=salla.config.get("store.apps");this.hideTitle=undefined;this.appsTitle=undefined;this.vertical=undefined;this.appSlot=((s=this.host.querySelector('[slot="app"]'))===null||s===void 0?void 0:s.innerHTML)||"<img alt={name} src={icon} />";salla.onReady((function(){t.apps=salla.config.get("store.apps")}));salla.lang.onLoaded((function(){t.appsTitle=salla.lang.get("blocks.footer.download_apps")}))}e.prototype.getAppsArray=function(){return Object.entries(this.apps).map((function(e){var t=e[0],s=e[1];return{name:t,value:s}}))};e.prototype.componentWillLoad=function(){return new Promise((function(e){return salla.onReady(e)}))};e.prototype.render=function(){var e=this;var t=this.getAppsArray();if(Array.isArray(t)&&!t.length){return}return h(Host,{class:"s-apps-icons"},!this.hideTitle&&h("h3",null,this.appsTitle),h("div",{class:{"s-apps-icons-list":true,vertical:this.vertical}},t.map((function(t,s){return h("a",{key:s,href:t.value,rel:"noreferrer",target:"_blank",class:"s-apps-icons-item",id:"app-slot",innerHTML:e.appSlot.replace(/\{icon\}/g,salla.url.cdn("images/".concat(t.name,".png"))).replace(/\{name\}/g,t.name)})}))))};e.prototype.componentDidRender=function(){var e;(e=this.host.querySelector('[slot="app"]'))===null||e===void 0?void 0:e.remove()};Object.defineProperty(e.prototype,"host",{get:function(){return getElement(this)},enumerable:false,configurable:true});return e}();SallaAppsIcons.style=sallaAppsIconsCss;export{SallaAppsIcons as salla_apps_icons};
//# sourceMappingURL=salla-apps-icons.entry.js.map