From c6eee9bf74cd6498e1f2f1fbd963eb99fe6ee223 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Mon, 6 Feb 2023 22:06:25 +0100 Subject: [PATCH] Update create helper dialog (#15288) --- src/components/ha-dialog.ts | 5 +- .../config/helpers/dialog-helper-detail.ts | 50 +++++++++++++------ 2 files changed, 39 insertions(+), 16 deletions(-) diff --git a/src/components/ha-dialog.ts b/src/components/ha-dialog.ts index 1e69ad2ac4..080dc647d9 100644 --- a/src/components/ha-dialog.ts +++ b/src/components/ha-dialog.ts @@ -46,7 +46,10 @@ export class HaDialog extends DialogBase { styles, css` .mdc-dialog { - --mdc-dialog-scroll-divider-color: var(--divider-color); + --mdc-dialog-scroll-divider-color: var( + --dialog-scroll-divider-color, + var(--divider-color) + ); z-index: var(--dialog-z-index, 7); -webkit-backdrop-filter: var(--dialog-backdrop-filter, none); backdrop-filter: var(--dialog-backdrop-filter, none); diff --git a/src/panels/config/helpers/dialog-helper-detail.ts b/src/panels/config/helpers/dialog-helper-detail.ts index ab0e7c5d64..1cab181d17 100644 --- a/src/panels/config/helpers/dialog-helper-detail.ts +++ b/src/panels/config/helpers/dialog-helper-detail.ts @@ -9,7 +9,8 @@ import { isComponentLoaded } from "../../../common/config/is_component_loaded"; import { dynamicElement } from "../../../common/dom/dynamic-element-directive"; import { shouldHandleRequestSelectedEvent } from "../../../common/mwc/handle-request-selected-event"; import "../../../components/ha-circular-progress"; -import "../../../components/ha-dialog"; +import { createCloseHeading } from "../../../components/ha-dialog"; +import "../../../components/ha-list-item"; import { getConfigFlowHandlers } from "../../../data/config_flow"; import { createCounter } from "../../../data/counter"; import { createInputBoolean } from "../../../data/input_boolean"; @@ -167,8 +168,9 @@ export class DialogHelperDetail extends LitElement { const isLoaded = !(domain in HELPERS) || isComponentLoaded(this.hass, domain); return html` - ${label} - + + ${!isLoaded ? html` - - ${this.hass!.localize("ui.common.cancel")} - `; } @@ -214,15 +214,19 @@ export class DialogHelperDetail extends LitElement { class=${classMap({ "button-left": !this._domain })} scrimClickAction escapeKeyAction - .heading=${this._domain - ? this.hass.localize( - "ui.panel.config.helpers.dialog.create_platform", - "platform", - this.hass.localize( - `ui.panel.config.helpers.types.${this._domain}` - ) || this._domain - ) - : this.hass.localize("ui.panel.config.helpers.dialog.create_helper")} + .hideActions=${!this._domain} + .heading=${createCloseHeading( + this.hass, + this._domain + ? this.hass.localize( + "ui.panel.config.helpers.dialog.create_platform", + "platform", + this.hass.localize( + `ui.panel.config.helpers.types.${this._domain}` + ) || this._domain + ) + : this.hass.localize("ui.panel.config.helpers.dialog.create_helper") + )} > ${content} @@ -285,6 +289,22 @@ export class DialogHelperDetail extends LitElement { ha-dialog.button-left { --justify-action-buttons: flex-start; } + ha-dialog { + --dialog-content-padding: 0; + --dialog-scroll-divider-color: transparent; + --mdc-dialog-max-height: 60vh; + } + @media all and (min-width: 550px) { + ha-dialog { + --mdc-dialog-min-width: 500px; + } + } + ha-icon-next { + width: 24px; + } + .form { + padding: 24px; + } `, ]; }