forked from verdnatura/hedera-web
65 lines
846 B
JavaScript
65 lines
846 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.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';
|
|
}
|
|
});
|