mirror of
https://github.com/kalkih/mini-graph-card.git
synced 2025-12-20 00:35:56 +01:00
feat(option): override icon with an image URL (#789)
* Override icon with an image URL added image attribute to override icon with a URL. (cherry picked from commit dc8aa9225c04c458ea50c8f8c1154535055dcf40) * Correct icon image height Kept parent div class the same. (cherry picked from commit 61fa0d3488212ab77c8d821344f581a9ac101ea2) * fix lint errors * Add as next version Co-authored-by: Jamie Pezone <jampez77@gmail.com>
This commit is contained in:
@@ -79,6 +79,7 @@ We recommend looking at the [Example usage section](#example-usage) to understan
|
||||
| type ***(required)*** | string | | v0.0.1 | `custom:mini-graph-card`.
|
||||
| entities ***(required)*** | list | | v0.2.0 | One or more sensor entities in a list, see [entities object](#entities-object) for additional entity options.
|
||||
| icon | string | | v0.0.1 | Set a custom icon from any of the available mdi icons.
|
||||
| icon_image | string | | NEXT_VERSION | Override icon with an image url
|
||||
| name | string | | v0.0.1 | Set a custom name which is displayed beside the icon.
|
||||
| unit | string | | v0.0.1 | Set a custom unit of measurement.
|
||||
| tap_action | [action object](#action-object-options) | | v0.7.0 | Action on click/tap.
|
||||
|
||||
@@ -227,6 +227,14 @@ class MiniGraphCard extends LitElement {
|
||||
}
|
||||
|
||||
renderIcon() {
|
||||
if (this.config.icon_image !== 'undefined') {
|
||||
return html`
|
||||
<div class="icon">
|
||||
<img src="${this.config.icon_image}" height="25"/>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
|
||||
const { icon, icon_adaptive_color } = this.config.show;
|
||||
return icon ? html`
|
||||
<div class="icon" loc=${this.config.align_icon}
|
||||
|
||||
Reference in New Issue
Block a user