From ad49e9f7b03f15fb11ce7524ba00567e4f7ba3d5 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 7 Oct 2024 17:33:47 +0200 Subject: [PATCH] Add minimal size for badges and cards in edit mode (#22271) --- src/panels/lovelace/badges/hui-view-badges.ts | 5 ++++- src/panels/lovelace/sections/hui-grid-section.ts | 4 ++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/panels/lovelace/badges/hui-view-badges.ts b/src/panels/lovelace/badges/hui-view-badges.ts index 5253e161391a..9fa2dee8be87 100644 --- a/src/panels/lovelace/badges/hui-view-badges.ts +++ b/src/panels/lovelace/badges/hui-view-badges.ts @@ -8,6 +8,7 @@ import { PropertyValues, } from "lit"; import { customElement, property, state } from "lit/decorators"; +import { classMap } from "lit/directives/class-map"; import { repeat } from "lit/directives/repeat"; import { fireEvent } from "../../../common/dom/fire_event"; import "../../../components/ha-sortable"; @@ -124,7 +125,7 @@ export class HuiViewBadges extends LitElement { .options=${BADGE_SORTABLE_OPTIONS} invert-swap > -
+
${repeat( badges, (badge) => this._getBadgeKey(badge), @@ -185,6 +186,8 @@ export class HuiViewBadges extends LitElement { hui-badge-edit-mode { display: block; position: relative; + min-width: 36px; + min-height: 36px; } .add { diff --git a/src/panels/lovelace/sections/hui-grid-section.ts b/src/panels/lovelace/sections/hui-grid-section.ts index b470416f44ca..73894cc3bbf6 100644 --- a/src/panels/lovelace/sections/hui-grid-section.ts +++ b/src/panels/lovelace/sections/hui-grid-section.ts @@ -204,6 +204,10 @@ export class GridSection extends LitElement implements LovelaceSectionElement { grid-column: span min(var(--column-size, 1), var(--grid-column-count)); } + .container.edit-mode .card { + min-height: calc((var(--row-height) - var(--row-gap)) / 2); + } + .card.fit-rows { height: calc( (var(--row-size, 1) * (var(--row-height) + var(--row-gap))) - var(