UNPKG

@salla.sa/twilight-components

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