mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 11:39:21 +03:00
*.jsx -> *.js
This commit is contained in:
parent
0a2b826f71
commit
e88c193334
98 changed files with 341 additions and 340 deletions
27
dev/Component/SvgIcon.js
Normal file
27
dev/Component/SvgIcon.js
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
|
||||
import $ from '$';
|
||||
|
||||
let cachedUrl = null;
|
||||
const getUrl = () => {
|
||||
if (!cachedUrl)
|
||||
{
|
||||
const version = $('#rlAppVersion').attr('content') || '0.0.0';
|
||||
cachedUrl = `rainloop/v/${version}/static/css/svg/icons.svg`;
|
||||
}
|
||||
|
||||
return cachedUrl;
|
||||
};
|
||||
|
||||
module.exports = {
|
||||
template: '<b></b>',
|
||||
viewModel: {
|
||||
createViewModel: ({icon = 'null'}, componentInfo) => {
|
||||
if (componentInfo && componentInfo.element)
|
||||
{
|
||||
$(componentInfo.element).replaceWith(
|
||||
`<svg class="svg-icon svg-icon-${icon}"><use xlink:href="${getUrl()}#svg-icon-${icon}"></use></svg>`
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue