Skip to content

Commit

Permalink
Fix add category and add label animation (#20272)
Browse files Browse the repository at this point in the history
  • Loading branch information
piitaya authored Mar 29, 2024
1 parent 11cf2ec commit e05595f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
13 changes: 12 additions & 1 deletion src/components/ha-filter-categories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,11 @@ export class HaFilterCategories extends SubscribeMixin(LitElement) {
: nothing}
</ha-expansion-panel>
${this.expanded
? html`<ha-list-item graphic="icon" @click=${this._addCategory}>
? html`<ha-list-item
graphic="icon"
@click=${this._addCategory}
class="add"
>
<ha-svg-icon slot="graphic" .path=${mdiPlus}></ha-svg-icon>
${this.hass.localize("ui.panel.config.category.editor.add")}
</ha-list-item>`
Expand Down Expand Up @@ -256,6 +260,7 @@ export class HaFilterCategories extends SubscribeMixin(LitElement) {
css`
:host {
border-bottom: 1px solid var(--divider-color);
position: relative;
}
:host([expanded]) {
flex: 1;
Expand Down Expand Up @@ -293,6 +298,12 @@ export class HaFilterCategories extends SubscribeMixin(LitElement) {
.warning {
color: var(--error-color);
}
.add {
position: absolute;
bottom: 0;
right: 0;
left: 0;
}
`,
];
}
Expand Down
13 changes: 12 additions & 1 deletion src/components/ha-filter-labels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,11 @@ export class HaFilterLabels extends SubscribeMixin(LitElement) {
: nothing}
</ha-expansion-panel>
${this.expanded
? html`<ha-list-item graphic="icon" @click=${this._addLabel}>
? html`<ha-list-item
graphic="icon"
@click=${this._addLabel}
class="add"
>
<ha-svg-icon slot="graphic" .path=${mdiPlus}></ha-svg-icon>
${this.hass.localize("ui.panel.config.labels.add_label")}
</ha-list-item>`
Expand Down Expand Up @@ -149,6 +153,7 @@ export class HaFilterLabels extends SubscribeMixin(LitElement) {
haStyleScrollbar,
css`
:host {
position: relative;
border-bottom: 1px solid var(--divider-color);
}
:host([expanded]) {
Expand Down Expand Up @@ -186,6 +191,12 @@ export class HaFilterLabels extends SubscribeMixin(LitElement) {
--ha-label-background-color: var(--color, var(--grey-color));
--ha-label-background-opacity: 0.5;
}
.add {
position: absolute;
bottom: 0;
right: 0;
left: 0;
}
`,
];
}
Expand Down

0 comments on commit e05595f

Please sign in to comment.