mirror of
https://github.com/danbulant/dribbblish-dynamic-theme
synced 2026-06-07 08:40:44 +00:00
refactor Icons.js a bit
This commit is contained in:
parent
b60682cac5
commit
6ac36c80a3
1 changed files with 8 additions and 7 deletions
|
|
@ -50,23 +50,24 @@ export default class Icons {
|
||||||
svg.attributes.width = options.size;
|
svg.attributes.width = options.size;
|
||||||
svg.attributes.height = options.size;
|
svg.attributes.height = options.size;
|
||||||
|
|
||||||
|
// Create CSSStyleDeclaration by creating an element since there is no constructor for it
|
||||||
|
const styles = document.createElement("a").style;
|
||||||
if (options.scale != 1) {
|
if (options.scale != 1) {
|
||||||
|
styles.transform = `scale(${options.scale})`;
|
||||||
|
styles.transformOrigin = "center";
|
||||||
|
}
|
||||||
svg.children = svg.children.map((child) => {
|
svg.children = svg.children.map((child) => {
|
||||||
child.attributes.style = `transform: scale(${options.scale}); transform-origin: center;`;
|
child.attributes.style = styles.cssText;
|
||||||
return child;
|
return child;
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
if (options.title != null) {
|
if (options.title != null) {
|
||||||
console.log(options);
|
|
||||||
console.log(svg);
|
|
||||||
svg.children.push({
|
svg.children.push({
|
||||||
name: "title",
|
name: "title",
|
||||||
type: "element",
|
type: "element",
|
||||||
value: "",
|
value: "",
|
||||||
children: [{ name: "", type: "text", value: options.title, attributes: {}, children: [] }]
|
children: [{ name: "", type: "text", value: options.title, attributes: {}, children: [] }]
|
||||||
});
|
});
|
||||||
console.log(svg);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.base64) {
|
if (options.base64) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue