Add support for images from Brands (#12276)

This commit is contained in:
Franck Nijhof 2020-03-06 15:05:39 +01:00 committed by GitHub
parent b56d6638c1
commit 2a523a4d20
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 2 deletions

View File

@ -5,6 +5,8 @@
<div class='brand-logo-container section'>
{%- if page.logo -%}
<img src='/images/supported_brands/{{ page.logo }}' />
{%- else -%}
<img src='https://brands.home-assistant.io/{{ page.ha_domain }}/logo.png' srcset='https://brands.home-assistant.io/{{ page.ha_domain }}/logo@2x.png 2x' />
{%- endif -%}
</div>

View File

@ -95,7 +95,7 @@ var allComponents = [
{% capture category %}"{{ ha_category | slugify | downcase }}"{% endcapture %}
{% assign categories = categories | push: category %}
{%- endfor -%}
{url:"{{ component.url }}", title:"{{component.title}}", cat: [{{categories|join: ","}}], featured: {% if component.featured %}true{% else %}false{% endif %}, v: "{{major_version}}.{{minor_version}}", logo: "{{component.logo}}"},
{url:"{{ component.url }}", title:"{{component.title}}", cat: [{{categories|join: ","}}], featured: {% if component.featured %}true{% else %}false{% endif %}, v: "{{major_version}}.{{minor_version}}", logo: "{{component.logo}}", domain: "{{component.ha_domain}}"},
{% endif -%}
{%- endfor -%}
false
@ -144,7 +144,7 @@ allComponents.pop(); // remove placeholder element at the end
components: [],
image: function () {
if (this.logo === '') {
return '';
return '<img src="https://brands.home-assistant.io/' + this.domain + '/logo.png" srcset="https://brands.home-assistant.io/' + this.domain + '/logo@2x.png 2x">';
} else {
return '<img data-src="/images/supported_brands/' + this.logo + '">';
}