Skip to content

Commit

Permalink
Merge pull request #26 from hjbotha/add-icon-column
Browse files Browse the repository at this point in the history
add support for fields containing icon string
  • Loading branch information
iantrich committed Jan 27, 2021
2 parents a311647 + 87719d3 commit b4b50a6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ From left to right: [feedparser](https://github.com/custom-components/sensor.fee
| title | string | **Required** | Column header to display.
| field | string | **Required** | key value of the entity that you wish to display.
| add_link | string | **Optional** | key value of entity that has the link property to use.
| type | string | **Optional** | options are `image`. Default is `None`. **Only set this for images, otherwise leave blank**
| type | string | **Optional** | options are `image` and `icon`. Default is `None`. **Only set this for images or icons, otherwise leave blank**
| style | object | **Optional** | CSS styles to apply to this column.
| width | string | **Optional** | If type is image, sets the width of the image. Default 70.
| height | string | **Optional** | If type is image, sets the width of the image. Default 90.
Expand Down
2 changes: 2 additions & 0 deletions list-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,8 @@ class ListCard extends HTMLElement {
var url = feed[entry][columns[column].field]
}
card_content += `<img id="image" src="${url}" width="${image_width}" height="${image_height}">`;
} else if (columns[column].type === 'icon') {
card_content += `<ha-icon class="column-${columns[column].field}" icon=${feed[entry][columns[column].field]}></ha-icon>`;
}
// else if (columns[column].type === 'button') {
// card_content += `<paper-button raised>${feed[entry][columns[column].button_text]}</paper-button>`;
Expand Down

0 comments on commit b4b50a6

Please sign in to comment.