From 55844f4c69313cb0ef18248a4ee372feb6225221 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Fri, 26 Jun 2020 18:14:29 +0000 Subject: [PATCH] Fix config dashboard scroll on desktop --- .../config/dashboard/ha-config-dashboard.ts | 181 ++++++++++-------- 1 file changed, 96 insertions(+), 85 deletions(-) diff --git a/src/panels/config/dashboard/ha-config-dashboard.ts b/src/panels/config/dashboard/ha-config-dashboard.ts index b416e3b9b974..87ca5ea45777 100644 --- a/src/panels/config/dashboard/ha-config-dashboard.ts +++ b/src/panels/config/dashboard/ha-config-dashboard.ts @@ -26,7 +26,8 @@ import { mdiCloudLock } from "@mdi/js"; class HaConfigDashboard extends LitElement { @property() public hass!: HomeAssistant; - @property() public narrow!: boolean; + @property({ type: Boolean, reflect: true }) + public narrow!: boolean; @property() public isWide!: boolean; @@ -35,6 +36,96 @@ class HaConfigDashboard extends LitElement { @property() public showAdvanced!: boolean; protected render(): TemplateResult { + const content = html` +
+ ${this.hass.localize("ui.panel.config.header")} +
+ +
+ ${this.hass.localize("ui.panel.config.introduction")} +
+ + ${this.cloudStatus && isComponentLoaded(this.hass, "cloud") + ? html` + + + + ` + : ""} + ${Object.values(configSections).map( + (section) => html` + + + + ` + )} + ${isComponentLoaded(this.hass, "zha") + ? html` +
+ ${this.hass.localize( + "ui.panel.config.integration_panel_move.missing_zha", + "integrations_page", + html` + ${this.hass.localize( + "ui.panel.config.integration_panel_move.link_integration_page" + )} + ` + )} +
+ ` + : ""} + ${isComponentLoaded(this.hass, "zwave") + ? html` +
+ ${this.hass.localize( + "ui.panel.config.integration_panel_move.missing_zwave", + "integrations_page", + html` + ${this.hass.localize( + "ui.panel.config.integration_panel_move.link_integration_page" + )} + ` + )} +
+ ` + : ""} + ${!this.showAdvanced + ? html` +
+ ${this.hass.localize("ui.panel.config.advanced_mode.hint_enable")} + ${this.hass.localize( + "ui.panel.config.advanced_mode.link_profile_page" + )}. +
+ ` + : ""} +
`; + + if (!this.narrow) { + return content; + } + return html` @@ -46,90 +137,7 @@ class HaConfigDashboard extends LitElement { - -
- ${this.hass.localize("ui.panel.config.header")} -
- -
- ${this.hass.localize("ui.panel.config.introduction")} -
- - ${this.cloudStatus && isComponentLoaded(this.hass, "cloud") - ? html` - - - - ` - : ""} - ${Object.values(configSections).map( - (section) => html` - - - - ` - )} - ${isComponentLoaded(this.hass, "zha") - ? html` -
- ${this.hass.localize( - "ui.panel.config.integration_panel_move.missing_zha", - "integrations_page", - html` - ${this.hass.localize( - "ui.panel.config.integration_panel_move.link_integration_page" - )} - ` - )} -
- ` - : ""} - ${isComponentLoaded(this.hass, "zwave") - ? html` -
- ${this.hass.localize( - "ui.panel.config.integration_panel_move.missing_zwave", - "integrations_page", - html` - ${this.hass.localize( - "ui.panel.config.integration_panel_move.link_integration_page" - )} - ` - )} -
- ` - : ""} - ${!this.showAdvanced - ? html` -
- ${this.hass.localize( - "ui.panel.config.advanced_mode.hint_enable" - )} - ${this.hass.localize( - "ui.panel.config.advanced_mode.link_profile_page" - )}. -
- ` - : ""} -
+ ${content}
`; } @@ -145,6 +153,9 @@ class HaConfigDashboard extends LitElement { margin-bottom: 24px; } ha-config-section { + margin-top: -12px; + } + :host([narrow]) ha-config-section { margin-top: -20px; } ha-card {