Skip to content

Commit

Permalink
Add minimal size for badges and cards in edit mode (#22271)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Oct 7, 2024
1 parent e32b15e commit ad49e9f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/panels/lovelace/badges/hui-view-badges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -124,7 +125,7 @@ export class HuiViewBadges extends LitElement {
.options=${BADGE_SORTABLE_OPTIONS}
invert-swap
>
<div class="badges">
<div class="badges ${classMap({ "edit-mode": editMode })}">
${repeat(
badges,
(badge) => this._getBadgeKey(badge),
Expand Down Expand Up @@ -185,6 +186,8 @@ export class HuiViewBadges extends LitElement {
hui-badge-edit-mode {
display: block;
position: relative;
min-width: 36px;
min-height: 36px;
}
.add {
Expand Down
4 changes: 4 additions & 0 deletions src/panels/lovelace/sections/hui-grid-section.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit ad49e9f

Please sign in to comment.