Add a docs icon to the config flow dialog

This commit is contained in:
Paulus Schoutsen 2022-02-10 14:27:38 -08:00
parent ed84ce9692
commit f59cb661cd

View File

@ -1,5 +1,5 @@
import "@material/mwc-button"; import "@material/mwc-button";
import { mdiClose } from "@mdi/js"; import { mdiClose, mdiHelpCircleOutline } from "@mdi/js";
import type { UnsubscribeFunc } from "home-assistant-js-websocket"; import type { UnsubscribeFunc } from "home-assistant-js-websocket";
import { import {
css, css,
@ -33,6 +33,7 @@ import {
} from "../../data/device_registry"; } from "../../data/device_registry";
import { haStyleDialog } from "../../resources/styles"; import { haStyleDialog } from "../../resources/styles";
import type { HomeAssistant } from "../../types"; import type { HomeAssistant } from "../../types";
import { documentationUrl } from "../../util/documentation-url";
import { showAlertDialog } from "../generic/show-dialog-box"; import { showAlertDialog } from "../generic/show-dialog-box";
import { import {
DataEntryFlowDialogParams, DataEntryFlowDialogParams,
@ -231,6 +232,24 @@ class DataEntryFlowDialog extends LitElement {
// to reset the element. // to reset the element.
"" ""
: html` : html`
<div class="dialog-actions">
${this._step
? html`
<a
href=${documentationUrl(
this.hass,
`/integrations/${this._step.handler}`
)}
target="_blank"
rel="noreferrer noopener"
><ha-icon-button
.label=${"Help"}
.path=${mdiHelpCircleOutline}
?rtl=${computeRTL(this.hass)}
></ha-icon-button
></a>
`
: ""}
<ha-icon-button <ha-icon-button
.label=${this.hass.localize( .label=${this.hass.localize(
"ui.panel.config.integrations.config_flow.dismiss" "ui.panel.config.integrations.config_flow.dismiss"
@ -239,6 +258,7 @@ class DataEntryFlowDialog extends LitElement {
dialogAction="close" dialogAction="close"
?rtl=${computeRTL(this.hass)} ?rtl=${computeRTL(this.hass)}
></ha-icon-button> ></ha-icon-button>
</div>
${this._step === null ${this._step === null
? this._handler ? this._handler
? html`<step-flow-pick-flow ? html`<step-flow-pick-flow
@ -452,16 +472,19 @@ class DataEntryFlowDialog extends LitElement {
ha-dialog { ha-dialog {
--dialog-content-padding: 0; --dialog-content-padding: 0;
} }
ha-icon-button { .dialog-actions {
padding: 16px; padding: 16px;
position: absolute; position: absolute;
top: 0; top: 0;
right: 0; right: 0;
} }
ha-icon-button[rtl] { .dialog-actions[rtl] {
right: auto; right: auto;
left: 0; left: 0;
} }
.dialog-actions > * {
color: var(--secondary-text-color);
}
`, `,
]; ];
} }