Skip to content

Commit

Permalink
Don't fit grid with multiline secondary option in template card (#1402)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Apr 3, 2024
1 parent 64318c6 commit 79a4f56
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/cards/template-card/template-card.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,18 +91,21 @@ export class TemplateCard extends MushroomBaseElement implements LovelaceCard {

public getLayoutOptions(): LovelaceLayoutOptions {
this._inGrid = true;
const options = {
const options: LovelaceLayoutOptions = {
grid_columns: 2,
grid_rows: 1,
};
if (!this._config) return options;
const appearance = computeAppearance(this._config);
if (appearance.layout === "vertical") {
options.grid_rows += 1;
options.grid_rows! += 1;
}
if (appearance.layout === "horizontal") {
options.grid_columns = 4;
}
if (this._config?.multiline_secondary) {
options.grid_rows = undefined
}
return options;
}

Expand Down

0 comments on commit 79a4f56

Please sign in to comment.