Skip to content

Commit

Permalink
Add section max width variable to section view (#19995)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Mar 5, 2024
1 parent d951e68 commit 8ca5b75
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/panels/lovelace/views/hui-sections-view.ts
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,19 @@ export class SectionsView extends LitElement implements LovelaceViewElement {
--grid-gap: 32px;
--grid-max-section-count: 4;
--grid-section-min-width: 320px;
--grid-section-max-width: 500px;
/* Calculated */
--max-count: min(var(--section-count), var(--grid-max-section-count));
--grid-max-width: calc(
(var(--max-count) + 1) * var(--grid-section-min-width) +
(var(--max-count) + 2) * var(--grid-gap) - 1px
--grid-max-width: min(
calc(
(var(--max-count) + 1) * var(--grid-section-min-width) +
(var(--max-count) + 2) * var(--grid-gap) - 1px
),
calc(
var(--max-count) * var(--grid-section-max-width) +
(var(--max-count) + 1) * var(--grid-gap)
)
);
display: grid;
Expand Down

0 comments on commit 8ca5b75

Please sign in to comment.