0
1
Fork 0
hedera-web-mindshore/js/htk/icon.js

64 lines
817 B
JavaScript

var Widget = require ('./widget');
module.exports = new Class
({
Extends: Widget
,Tag: 'htk-icon'
,Properties:
{
icon:
{
type: String
,set: function (x)
{
this._icon = x;
this._setIcon ();
}
,get: function ()
{
return this._icon;
}
},
theme:
{
type: String
,set: function (x)
{
this._theme = x;
this._setIcon ();
}
,get: function ()
{
return this._theme;
}
},
alt:
{
type: String
,set: function (x)
{
this.node.alt = x;
}
,get: function ()
{
return this.node.alt;
}
}
}
,_icon: null
,render: function ()
{
this.createRoot ('img');
}
,_setIcon: function ()
{
var theme = this._theme ? this._theme : 'light';
this.node.src = 'image/icon/'+ theme +'/'+ this._icon +'.svg';
}
});