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 and bramkragten committed Mar 6, 2024
1 parent bf2fad2 commit 36c3b93
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: 20px;
--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 36c3b93

Please sign in to comment.