mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Set the max number of columns to 3 for area dashboard (#24802)
* Set the max number of columns to 4 for area dashboard * Set it to 3
This commit is contained in:
parent
94ee99160b
commit
23229b3e3b
@ -1,5 +1,6 @@
|
||||
import { ReactiveElement } from "lit";
|
||||
import { customElement } from "lit/decorators";
|
||||
import { clamp } from "../../../../common/number/clamp";
|
||||
import type { LovelaceBadgeConfig } from "../../../../data/lovelace/config/badge";
|
||||
import type { LovelaceCardConfig } from "../../../../data/lovelace/config/card";
|
||||
import type { LovelaceSectionRawConfig } from "../../../../data/lovelace/config/section";
|
||||
@ -144,7 +145,10 @@ export class AreaViewStrategy extends ReactiveElement {
|
||||
});
|
||||
}
|
||||
|
||||
// Take the full width if there is only one section to avoid misalignment between cards and header
|
||||
// Allow between 2 and 3 columns (the max should be set to define the width of the header)
|
||||
const maxColumns = clamp(sections.length, 2, 3);
|
||||
|
||||
// Take the full width if there is only one section to avoid narrow header on desktop
|
||||
if (sections.length === 1) {
|
||||
sections[0].column_span = 2;
|
||||
}
|
||||
@ -160,7 +164,7 @@ export class AreaViewStrategy extends ReactiveElement {
|
||||
content: `## ${area.name}`,
|
||||
},
|
||||
},
|
||||
max_columns: 2,
|
||||
max_columns: maxColumns,
|
||||
sections: sections,
|
||||
badges: badges,
|
||||
};
|
||||
|
@ -95,7 +95,7 @@ export class AreasOverviewViewStrategy extends ReactiveElement {
|
||||
|
||||
return {
|
||||
type: "sections",
|
||||
max_columns: 2,
|
||||
max_columns: 3,
|
||||
sections: areaSections,
|
||||
};
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user