Skip to content
This repository has been archived by the owner on Mar 13, 2018. It is now read-only.

Commit

Permalink
add css-sizable mode to core-icon; activate using size=""
Browse files Browse the repository at this point in the history
  • Loading branch information
sorvell committed Jun 13, 2014
1 parent ae8bb68 commit e24f587
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 1 deletion.
12 changes: 12 additions & 0 deletions core-icon.css
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,15 @@ html /deep/ core-icon {
vertical-align: middle;
background-repeat: no-repeat;
}

html /deep/ core-icon[size=""] {
position: relative;
}

html /deep/ core-icon[size=""] > svg {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
}
2 changes: 1 addition & 1 deletion core-icon.html
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
},

updateIcon: function() {
this.style.width = this.style.height = this.size + 'px';
this.style.width = this.style.height = this.size ? this.size + 'px' : '';
if (this.icon) {
var parts = String(this.icon).split(':');
var icon = parts.pop();
Expand Down
9 changes: 9 additions & 0 deletions demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@
segment {
min-width: 200px;
}

core-icon.sized {
height: 128px;
width: 128px;
}
</style>
</head>
<body unresolved>
Expand All @@ -29,6 +34,10 @@
</template>
</div>
<core-iconset id="meta"></core-iconset>
<div hidden?="{{!$.meta.metaData.icons.iconNames}}">
Sized icon:
<core-icon class="sized" icon="accessibility" size=""></core-icon>
</div>
</template>

</body>
Expand Down

0 comments on commit e24f587

Please sign in to comment.