From ef10cc77f777bb1bd00f28ace3f5d3dcc8942539 Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Thu, 30 Mar 2023 16:10:43 +0200 Subject: [PATCH] Fix lovelace background, tweak headers (#15977) --- src/components/ha-dialog.ts | 4 +- src/layouts/hass-tabs-subpage-data-table.ts | 2 +- .../integrations/ha-config-integrations.ts | 44 +++++++++++------- src/panels/lovelace/hui-root.ts | 45 +++++++++++-------- 4 files changed, 58 insertions(+), 37 deletions(-) diff --git a/src/components/ha-dialog.ts b/src/components/ha-dialog.ts index b7aff993c0..d0c0ae8596 100644 --- a/src/components/ha-dialog.ts +++ b/src/components/ha-dialog.ts @@ -41,7 +41,9 @@ export class HaDialog extends DialogBase { SUPPRESS_DEFAULT_PRESS_SELECTOR, ].join(", "); this._updateScrolledAttribute(); - this.contentElement?.addEventListener("scroll", this._onScroll); + this.contentElement?.addEventListener("scroll", this._onScroll, { + passive: true, + }); } disconnectedCallback(): void { diff --git a/src/layouts/hass-tabs-subpage-data-table.ts b/src/layouts/hass-tabs-subpage-data-table.ts index 125adc1a81..90c8035761 100644 --- a/src/layouts/hass-tabs-subpage-data-table.ts +++ b/src/layouts/hass-tabs-subpage-data-table.ts @@ -323,7 +323,7 @@ export class HaTabsSubpageDataTable extends LitElement { --text-field-overflow: initial; display: flex; justify-content: flex-end; - margin-right: 8px; + margin-right: -8px; color: var(--primary-text-color); } .active-filters { diff --git a/src/panels/config/integrations/ha-config-integrations.ts b/src/panels/config/integrations/ha-config-integrations.ts index 797c7db8a4..62b203c42c 100644 --- a/src/panels/config/integrations/ha-config-integrations.ts +++ b/src/panels/config/integrations/ha-config-integrations.ts @@ -376,7 +376,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { ); const filterMenu = html` -
+
`} @@ -845,7 +846,6 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { .container > * { max-width: 500px; } - .empty-message { margin: auto; text-align: center; @@ -884,6 +884,16 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) { right: 0; left: 0; } + .filters { + --mdc-text-field-fill-color: var(--input-fill-color); + --mdc-text-field-idle-line-color: var(--input-idle-line-color); + --mdc-shape-small: 4px; + --text-field-overflow: initial; + display: flex; + justify-content: flex-end; + margin-right: -8px; + color: var(--primary-text-color); + } .active-filters { color: var(--primary-text-color); position: relative; diff --git a/src/panels/lovelace/hui-root.ts b/src/panels/lovelace/hui-root.ts index 8e2e9c88bc..fd784ba133 100644 --- a/src/panels/lovelace/hui-root.ts +++ b/src/panels/lovelace/hui-root.ts @@ -26,7 +26,13 @@ import { PropertyValues, TemplateResult, } from "lit"; -import { customElement, property, query, state } from "lit/decorators"; +import { + customElement, + eventOptions, + property, + query, + state, +} from "lit/decorators"; import { classMap } from "lit/directives/class-map"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; @@ -116,9 +122,9 @@ class HUIRoot extends LitElement { return html`
@@ -547,11 +553,20 @@ class HUIRoot extends LitElement { ` : ""}
-
+
`; } + @eventOptions({ passive: true }) + private _viewScrolled(ev) { + this.toggleAttribute("scrolled", ev.currentTarget.scrollTop !== 0); + } + private _isVisible = (view: LovelaceViewConfig) => Boolean( this._editMode || @@ -947,6 +962,10 @@ class HUIRoot extends LitElement { top: 0; width: var(--mdc-top-app-bar-width, 100%); z-index: 2; + transition: box-shadow 0.3s ease-out; + } + :host([scrolled]) .header { + box-shadow: 0px 0px 8px 0px rgba(0, 0, 0, 0.75); } .edit-mode .header { background-color: var(--app-header-edit-background-color, #455a64); @@ -1025,14 +1044,10 @@ class HUIRoot extends LitElement { 100vh - var(--header-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom) ); - /** - * Since we only set min-height, if child nodes need percentage - * heights they must use absolute positioning so we need relative - * positioning here. - * - * https://www.w3.org/TR/CSS2/visudet.html#the-height-property - */ - position: relative; + background: var( + --lovelace-background, + var(--primary-background-color) + ); display: flex; overflow: auto; } @@ -1064,12 +1079,6 @@ class HUIRoot extends LitElement { .menu-link { text-decoration: none; } - hui-view { - background: var( - --lovelace-background, - var(--primary-background-color) - ); - } .exit-edit-mode { --mdc-theme-primary: var(--app-header-edit-text-color, #fff); --mdc-button-outline-color: var(--app-header-edit-text-color, #fff);