Skip to content

Commit c1d5ace

Browse files
authored
Merge pull request #27 from takenet/feature/add-icons
Feature/add icons
2 parents 44b23d6 + ec4e893 commit c1d5ace

8 files changed

Lines changed: 37 additions & 0 deletions

File tree

src/components/icon/icon.component.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,22 @@ class IconController implements IComponentController {
4141
}
4242
}
4343

44+
$onChanges(changes) {
45+
const svg = (this.$element[0] as HTMLElement).firstElementChild;
46+
47+
if (!svg) {
48+
return;
49+
}
50+
51+
if ('width' in changes && changes.width !== this.width) {
52+
svg.setAttribute('width', this.width);
53+
} else if ('height' in changes && changes.height !== this.height) {
54+
svg.setAttribute('height', this.height);
55+
} else if ('color' in changes && changes.color !== this.color) {
56+
this.clearPathsAndFillColor(svg, this.color);
57+
}
58+
}
59+
4460
clearPathsAndFillColor(svg: Element, color: string) {
4561
let paths = svg.getElementsByTagName('path');
4662

Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

0 commit comments

Comments
 (0)