Skip to content

Commit

Permalink
fix: dynamic color and size updates will be reflected
Browse files Browse the repository at this point in the history
  • Loading branch information
ju-Skinner committed Aug 1, 2024
1 parent 8772e3e commit ca33cff
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 0 deletions.
50 changes: 50 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/components/pds-icon/pds-icon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ export class PdsIcon {
}
}

@Watch('size')
@Watch('color')
updateStyles() {
this.setCSSVariables();
}

@Watch('name')
@Watch('src')
@Watch('icon')
Expand Down
7 changes: 7 additions & 0 deletions src/index-template.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,13 @@ <h3>Default Sizes</h3>
<h3>Custom size</h3>
<pds-icon name="youtube" size="140px"></pds-icon>

<h3>Custom size using a class</h3>
<p>Style will override the size of 140px and be set to 20px</p>
<style>
.custom-class { height: 20px; width: 20px; }
</style>
<pds-icon name="youtube" size="140px" class="custom-class"></pds-icon>

<h3>Color</h3>
<pds-icon name="youtube" size="140px" color="red"></pds-icon>

Expand Down

0 comments on commit ca33cff

Please sign in to comment.