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

65 lines
846 B
JavaScript
Raw Normal View History

2016-09-26 09:28:47 +00:00
var Widget = require ('./widget');
module.exports = new Class
({
Extends: Widget
,Tag: 'htk-icon'
,Properties:
{
icon:
{
type: String
,set: function (x)
{
this._icon = x;
this.render ();
}
,get: function ()
{
return this._icon;
}
},
theme:
{
type: String
,set: function (x)
{
this._theme = x;
this.render ();
}
,get: function ()
{
return this._theme;
}
},
alt:
{
type: String
,set: function (x)
{
this.node.alt = x;
}
,get: function ()
{
return this.node.alt;
}
}
}
,_icon: null
,initialize: function (props)
{
this.createElement ('img');
this.parent (props);
}
,render: function ()
{
var theme = this._theme ? this._theme : 'light';
this.node.src = 'image/icon/'+ theme +'/'+ this._icon +'.svg';
}
});