From 0e34d45ab563a3a9c2bf87433abf949c1a9d1d8f Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Sat, 14 Oct 2023 16:51:23 +0000 Subject: [PATCH 1/2] No material web internals --- src/components/ha-outlined-button.ts | 9 +++------ src/components/ha-outlined-icon-button.ts | 16 +++------------- 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/src/components/ha-outlined-button.ts b/src/components/ha-outlined-button.ts index 36b9b0cec3ec..e4683469ca41 100644 --- a/src/components/ha-outlined-button.ts +++ b/src/components/ha-outlined-button.ts @@ -1,14 +1,11 @@ import { css } from "lit"; import { customElement } from "lit/decorators"; -import { OutlinedButton } from "@material/web/button/internal/outlined-button"; -import { styles as outlinedStyles } from "@material/web/button/internal/outlined-styles.css"; -import { styles as sharedStyles } from "@material/web/button/internal/shared-styles.css"; +import { MdOutlinedButton } from "@material/web/button/outlined-button"; @customElement("ha-outlined-button") -export class HaOutlinedButton extends OutlinedButton { +export class HaOutlinedButton extends MdOutlinedButton { static override styles = [ - sharedStyles, - outlinedStyles, + ...MdOutlinedButton.styles, css` :host { --ha-icon-display: block; diff --git a/src/components/ha-outlined-icon-button.ts b/src/components/ha-outlined-icon-button.ts index 7f6618d5024c..27a7d4fdcddc 100644 --- a/src/components/ha-outlined-icon-button.ts +++ b/src/components/ha-outlined-icon-button.ts @@ -1,21 +1,11 @@ import { css } from "lit"; import { customElement } from "lit/decorators"; -import { IconButton } from "@material/web/iconbutton/internal/icon-button"; -import { styles as outlinedStyles } from "@material/web/iconbutton/internal/outlined-styles.css"; -import { styles as sharedStyles } from "@material/web/iconbutton/internal/shared-styles.css"; +import { MdOutlinedIconButton } from "@material/web/iconbutton/outlined-icon-button"; @customElement("ha-outlined-icon-button") -export class HaOutlinedIconButton extends IconButton { - protected override getRenderClasses() { - return { - ...super.getRenderClasses(), - outlined: true, - }; - } - +export class HaOutlinedIconButton extends MdOutlinedIconButton { static override styles = [ - sharedStyles, - outlinedStyles, + ...MdOutlinedIconButton.styles, css` :host { --ha-icon-display: block; From 1191e87bbca666204b0ab40edf7d8659d78311b7 Mon Sep 17 00:00:00 2001 From: Simon Lamon <32477463+silamon@users.noreply.github.com> Date: Mon, 16 Oct 2023 15:03:09 +0200 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Bram Kragten --- src/components/ha-outlined-button.ts | 2 +- src/components/ha-outlined-icon-button.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/ha-outlined-button.ts b/src/components/ha-outlined-button.ts index e4683469ca41..92cff6fe75a2 100644 --- a/src/components/ha-outlined-button.ts +++ b/src/components/ha-outlined-button.ts @@ -5,7 +5,7 @@ import { MdOutlinedButton } from "@material/web/button/outlined-button"; @customElement("ha-outlined-button") export class HaOutlinedButton extends MdOutlinedButton { static override styles = [ - ...MdOutlinedButton.styles, + ...super.styles, css` :host { --ha-icon-display: block; diff --git a/src/components/ha-outlined-icon-button.ts b/src/components/ha-outlined-icon-button.ts index 27a7d4fdcddc..9aaa562ea5de 100644 --- a/src/components/ha-outlined-icon-button.ts +++ b/src/components/ha-outlined-icon-button.ts @@ -5,7 +5,7 @@ import { MdOutlinedIconButton } from "@material/web/iconbutton/outlined-icon-but @customElement("ha-outlined-icon-button") export class HaOutlinedIconButton extends MdOutlinedIconButton { static override styles = [ - ...MdOutlinedIconButton.styles, + ...super.styles, css` :host { --ha-icon-display: block;