Update to add height parameter

This commit is contained in:
William Moore 2023-06-06 15:19:11 -05:00
parent a8ba92b286
commit df36fe89c1
2 changed files with 6 additions and 1 deletions

View File

@ -61,12 +61,15 @@ export class LavenderConfigure extends LitElement {
const elem = widgets?.item(widgetI); const elem = widgets?.item(widgetI);
const titleEditElem = elem?.children.item(0)?.children.item(1) as HTMLInputElement; const titleEditElem = elem?.children.item(0)?.children.item(1) as HTMLInputElement;
const urlEditElem = elem?.children.item(1)?.children.item(1) as HTMLInputElement; const urlEditElem = elem?.children.item(1)?.children.item(1) as HTMLInputElement;
const heightEditElem = elem?.children.item(2)?.children.item(1) as HTMLInputElement;
const title = titleEditElem.value; const title = titleEditElem.value;
const url = urlEditElem.value; const url = urlEditElem.value;
const height = heightEditElem.value;
if (title && title.trim() !== '' && url && url.trim() !== '') { if (title && title.trim() !== '' && url && url.trim() !== '') {
lavenderWidgets.push({ lavenderWidgets.push({
title, title,
url, url,
height,
}); });
} }
} }
@ -87,12 +90,14 @@ export class LavenderConfigure extends LitElement {
<div name="widget-edit"> <div name="widget-edit">
<div><span>Title</span><input type="text" name="titleEdit" value="${widget.title}"></div> <div><span>Title</span><input type="text" name="titleEdit" value="${widget.title}"></div>
<div><span>Href</span><input type="text" name="urlEdit" value="${widget.url}"></div> <div><span>Href</span><input type="text" name="urlEdit" value="${widget.url}"></div>
<div><span>Height</span><input type="text" name="urlHeight" value="${widget.height}"></div>
</div> </div>
`; `;
})} })}
<div name="widget-edit"> <div name="widget-edit">
<div><span>Title </span><input type="text" name="titleEdit"></div > <div><span>Title </span><input type="text" name="titleEdit"></div >
<div><span>Href </span><input type="text" name="urlEdit"></div > <div><span>Href </span><input type="text" name="urlEdit"></div >
<div><span>Height</span><input type="text" name="urlHeight"></div>
</div> </div>
</div> </div>
<button class="button" @click="${() => this.save()}">Save</button> <button class="button" @click="${() => this.save()}">Save</button>

View File

@ -67,7 +67,7 @@ export class LavenderWidgets extends LitElement {
<h1 class="centerit">Lavender</h1> <h1 class="centerit">Lavender</h1>
<div class="widgets"> <div class="widgets">
${this.widgets.map((widget: any) => { ${this.widgets.map((widget: any) => {
return html`<iframe width="100%" framespacing="0" frameborder="no" src="${widget.url}" title="${widget.title}">${widget.title}</iframe>`; return html`<iframe width="100%" framespacing="0" frameborder="no" style="${widget.height ? `height: ${widget.height}` : ''}" src="${widget.url}" title="${widget.title}">${widget.title}</iframe>`;
})} })}
</div> </div>
`; `;