Skip to content

Commit b3f2059

Browse files
authored
Fix "Show More" button text invisibility by migrating to ha-button (#184)
- Replace deprecated `mwc-button` and `mwc-icon-button` with `ha-button` and `ha-icon-button` for compatibility with Home Assistant 2025.8+. - Update icon slots: use `slot="end"` for trailing icons and `slot="start"` for leading icons (fixes "Show More" text and "Add Task" icon alignment). Resolves #173
1 parent 596a0d6 commit b3f2059

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

grocy-chores-card.js

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ class GrocyChoresCard extends LitElement {
276276
<ha-button class="expand-button show-more-button"
277277
@click=${() => this._toggleOverflow(this.renderRoot)}>
278278
${this._translate("{number} More Items", this.overflow.length)}
279-
<ha-icon slot="trailingIcon" style="--mdc-icon-size: ${this.expand_icon_size}px;"
279+
<ha-icon slot="end" style="--mdc-icon-size: ${this.expand_icon_size}px;"
280280
.icon=${"mdi:chevron-down"}></ha-icon>
281281
</ha-button>
282282
</div>
@@ -291,7 +291,7 @@ class GrocyChoresCard extends LitElement {
291291
<ha-button class="expand-button show-more-button"
292292
@click=${() => this._toggleOverflow(this.renderRoot)}>
293293
${this._translate("Show Less")}
294-
<ha-icon slot="trailingIcon"
294+
<ha-icon slot="end"
295295
.icon=${"mdi:chevron-up"}></ha-icon>
296296
</ha-button>
297297
</div>
@@ -416,19 +416,19 @@ class GrocyChoresCard extends LitElement {
416416

417417
_renderAddTaskButton() {
418418
return html`
419-
<mwc-button class="hide-button" @click=${() => this._toggleAddTask()}>
420-
<ha-icon icon="mdi:chevron-down" id="add-task-icon"></ha-icon>
419+
<ha-button class="hide-button" @click=${() => this._toggleAddTask()}>
420+
<ha-icon slot="start" icon="mdi:chevron-down" id="add-task-icon"></ha-icon>
421421
${this._translate("Add task")}
422-
</mwc-button>
422+
</ha-button>
423423
`
424424
}
425425

426426
_renderAddTask() {
427427
return html`
428428
<div id="add-task-row" class="add-row hidden-class">
429-
<mwc-button @click=${() => this._addTask()}>
429+
<ha-button @click=${() => this._addTask()}>
430430
<ha-icon class="add-icon" icon="mdi:plus"></ha-icon>
431-
</mwc-button>
431+
</ha-button>
432432
<ha-textfield
433433
id="add-task"
434434
class="add-input"
@@ -452,20 +452,20 @@ class GrocyChoresCard extends LitElement {
452452
_renderTrackChoreButton(item) {
453453
if (this.chore_icon != null) {
454454
return html`
455-
<mwc-icon-button class="track-button"
455+
<ha-icon-button class="track-button"
456456
.label=${this._translate("Track")}
457457
@click=${() => this._trackChore(item)}>
458458
<ha-icon class="track-button-icon" style="--mdc-icon-size: ${this.chore_icon_size}px;"
459459
.icon=${this.chore_icon}></ha-icon>
460-
</mwc-icon-button>
460+
</ha-icon-button>
461461
`
462462
}
463463

464464
return html`
465-
<mwc-button
465+
<ha-button
466466
@click=${() => this._trackChore(item)}>
467467
${this._translate("Track")}
468-
</mwc-button>
468+
</ha-button>
469469
`
470470
}
471471

@@ -475,20 +475,20 @@ class GrocyChoresCard extends LitElement {
475475

476476
if (icon != null) {
477477
return html`
478-
<mwc-icon-button class="reschedule-button"
478+
<ha-icon-button class="reschedule-button"
479479
.label=${this._translate("Reschedule")}
480480
@click=${() => this._openRescheduleDialog(item)}>
481481
<ha-icon class="reschedule-button-icon" style="--mdc-icon-size: ${this.chore_icon_size}px;"
482482
.icon=${icon}></ha-icon>
483-
</mwc-icon-button>
483+
</ha-icon-button>
484484
`
485485
}
486486

487487
return html`
488-
<mwc-button
488+
<ha-button
489489
@click=${() => this._openRescheduleDialog(item)}>
490490
${this._translate("Reschedule")}
491-
</mwc-button>
491+
</ha-button>
492492
`
493493
}
494494

@@ -498,39 +498,39 @@ class GrocyChoresCard extends LitElement {
498498

499499
if (icon != null) {
500500
return html`
501-
<mwc-icon-button class="skip-button"
501+
<ha-icon-button class="skip-button"
502502
.label=${this._translate("Skip")}
503503
@click=${() => this._skipItem(item)}>
504504
<ha-icon class="skip-button-icon" style="--mdc-icon-size: ${this.chore_icon_size}px;"
505505
.icon=${icon}></ha-icon>
506-
</mwc-icon-button>
506+
</ha-icon-button>
507507
`
508508
}
509509

510510
return html`
511-
<mwc-button
511+
<ha-button
512512
@click=${() => this._skipItem(item)}>
513513
${this._translate("Skip")}
514-
</mwc-button>
514+
</ha-button>
515515
`
516516
}
517517

518518
_renderTrackTaskButton(item) {
519519
if (this.task_icon != null) {
520520
return html`
521-
<mwc-icon-button class="track-checkbox"
521+
<ha-icon-button class="track-checkbox"
522522
.label=${this._translate("Track")} @click=${() => this._trackTask(item.id, item.name)}>
523523
<ha-icon class="track-button-icon" style="--mdc-icon-size: ${this.task_icon_size}px;"
524524
.icon=${this.task_icon}></ha-icon>
525-
</mwc-icon-button>
525+
</ha-icon-button>
526526
`
527527
}
528528

529529
return html`
530-
<mwc-button
530+
<ha-button
531531
@click=${() => this._trackTask(item.id, item.name)}>
532532
${this._translate("Track")}
533-
</mwc-button>
533+
</ha-button>
534534
`
535535
}
536536

0 commit comments

Comments
 (0)