mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
Fix iframe aspect_ratio (#2004)
This commit is contained in:
parent
849d7d2d95
commit
23163b3095
@ -4,6 +4,7 @@ import "../../../components/ha-card";
|
|||||||
|
|
||||||
import { LovelaceCard, LovelaceConfig } from "../types";
|
import { LovelaceCard, LovelaceConfig } from "../types";
|
||||||
import { TemplateResult } from "lit-html";
|
import { TemplateResult } from "lit-html";
|
||||||
|
import { styleMap } from "lit-html/directives/styleMap";
|
||||||
|
|
||||||
interface Config extends LovelaceConfig {
|
interface Config extends LovelaceConfig {
|
||||||
aspect_ratio?: string;
|
aspect_ratio?: string;
|
||||||
@ -37,10 +38,16 @@ export class HuiIframeCard extends LitElement implements LovelaceCard {
|
|||||||
return html``;
|
return html``;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const aspectRatio = this._config.aspect_ratio || "50%";
|
||||||
|
|
||||||
return html`
|
return html`
|
||||||
${this.renderStyle()}
|
${this.renderStyle()}
|
||||||
<ha-card .header="${this._config.title}">
|
<ha-card .header="${this._config.title}">
|
||||||
<div id="root">
|
<div id="root"
|
||||||
|
style="${styleMap({
|
||||||
|
"padding-top": aspectRatio,
|
||||||
|
})}"
|
||||||
|
>
|
||||||
<iframe src="${this._config.url}"></iframe>
|
<iframe src="${this._config.url}"></iframe>
|
||||||
</div>
|
</div>
|
||||||
</ha-card>
|
</ha-card>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user