Add the possibility to load a custom layout with base64-encoded jsons

This commit is contained in:
Pieter Vander Vennet 2020-08-08 17:50:43 +02:00
parent 31ec3a7755
commit 14930e2f93
10 changed files with 296 additions and 74 deletions

View file

@ -1,4 +1,19 @@
export class Img {
/**
* If the source is an svg element, it is returned as is.
* If not, the source is wrapped into a 'img'-tag
* @param source
* @constructor
*/
static AsImageElement(source: string): string{
if(source.startsWith("<svg")){
return `<img src="data:image/svg+xml;base64,${(btoa(source))}">`;
}else{
return `<img src="${source}">`
}
}
static readonly checkmark = `<svg width="26" height="18" viewBox="0 0 26 18" fill="none" xmlns="http://www.w3.org/2000/svg"><path d="M3 7.28571L10.8261 15L23 3" stroke="black" stroke-width="4" stroke-linejoin="round"/></svg>`;
static readonly no_checkmark = `<svg width="26" height="18" viewBox="0 0 26 18" fill="none" xmlns="http://www.w3.org/2000/svg"></svg>`;