From dc3bad56f2d0935bfc5b3f01d7505e2931b4570f Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 4 Oct 2021 18:27:03 +0200 Subject: [PATCH] Improve padding/positioning of ha-alert (#10145) Co-authored-by: Paulus Schoutsen --- gallery/src/demos/demo-ha-alert.ts | 32 ++++++++++++++++++------------ src/components/ha-alert.ts | 31 ++++++++++++++--------------- 2 files changed, 34 insertions(+), 29 deletions(-) diff --git a/gallery/src/demos/demo-ha-alert.ts b/gallery/src/demos/demo-ha-alert.ts index e42c00f20e..677c772127 100644 --- a/gallery/src/demos/demo-ha-alert.ts +++ b/gallery/src/demos/demo-ha-alert.ts @@ -107,19 +107,21 @@ export class DemoHaAlert extends LitElement { protected render(): TemplateResult { return html` - ${alerts.map( - (alert) => html` - - ${alert.description} - - ` - )} +
+ ${alerts.map( + (alert) => html` + + ${alert.description} + + ` + )} +
`; } @@ -130,6 +132,10 @@ export class DemoHaAlert extends LitElement { max-width: 600px; margin: 24px auto; } + ha-alert { + display: block; + margin: 24px 0; + } .condition { padding: 16px; display: flex; diff --git a/src/components/ha-alert.ts b/src/components/ha-alert.ts index b9468a8b92..ddd3c641e7 100644 --- a/src/components/ha-alert.ts +++ b/src/components/ha-alert.ts @@ -51,15 +51,11 @@ class HaAlert extends LitElement { [this.alertType]: true, })}" > -
+
-
+
${this.title ? html`
${this.title}
` : ""}
@@ -94,7 +90,7 @@ class HaAlert extends LitElement { static styles = css` .issue-type { position: relative; - padding: 4px; + padding: 8px; display: flex; margin: 4px 0; } @@ -113,11 +109,16 @@ class HaAlert extends LitElement { border-radius: 4px; } .icon { - margin: 4px 8px; + margin-right: 8px; width: 24px; } - .main-content.no-title { - margin-top: 6px; + .icon.no-title { + align-self: center; + } + .issue-type.rtl > .icon { + margin-right: 0px; + margin-left: 8px; + width: 24px; } .issue-type.rtl > .content { flex-direction: row-reverse; @@ -126,24 +127,22 @@ class HaAlert extends LitElement { .content { display: flex; justify-content: space-between; + align-items: center; width: 100%; } .main-content { overflow-wrap: anywhere; } .title { + margin-top: 2px; font-weight: bold; - margin-top: 6px; } - mwc-button { --mdc-theme-primary: var(--primary-text-color); } - - .action { - align-self: center; + mwc-icon-button { + --mdc-icon-button-size: 36px; } - .issue-type.info > .icon { color: var(--info-color); }