mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 11:16:35 +00:00
Integrations header: center warning/error text (#17141)
Co-authored-by: Paul Bottein <paul.bottein@gmail.com>
This commit is contained in:
parent
a3b87a6e7b
commit
d427d9e7f6
@ -77,10 +77,13 @@ export class HaIntegrationActionCard extends LitElement {
|
|||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
margin-top: 8px;
|
margin-top: 8px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
max-width: 100%;
|
||||||
}
|
}
|
||||||
h3 {
|
h3 {
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
margin: 0;
|
margin: 0;
|
||||||
|
max-width: 100%;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
.header-button {
|
.header-button {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
|
@ -24,8 +24,6 @@ import { classMap } from "lit/directives/class-map";
|
|||||||
import memoizeOne from "memoize-one";
|
import memoizeOne from "memoize-one";
|
||||||
import { computeRTL } from "../../../common/util/compute_rtl";
|
import { computeRTL } from "../../../common/util/compute_rtl";
|
||||||
import "../../../components/ha-card";
|
import "../../../components/ha-card";
|
||||||
import "../../../components/ha-icon-next";
|
|
||||||
import "../../../components/ha-list-item";
|
|
||||||
import "../../../components/ha-svg-icon";
|
import "../../../components/ha-svg-icon";
|
||||||
import { ConfigEntry, ERROR_STATES } from "../../../data/config_entries";
|
import { ConfigEntry, ERROR_STATES } from "../../../data/config_entries";
|
||||||
import type { DeviceRegistryEntry } from "../../../data/device_registry";
|
import type { DeviceRegistryEntry } from "../../../data/device_registry";
|
||||||
@ -114,12 +112,6 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
: undefined}
|
: undefined}
|
||||||
.manifest=${this.manifest}
|
.manifest=${this.manifest}
|
||||||
>
|
>
|
||||||
<ha-icon-next
|
|
||||||
slot="header-button"
|
|
||||||
.label=${this.hass.localize(
|
|
||||||
"ui.panel.config.integrations.config_entry.configure"
|
|
||||||
)}
|
|
||||||
></ha-icon-next>
|
|
||||||
</ha-integration-header>
|
</ha-integration-header>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
@ -345,9 +337,6 @@ export class HaIntegrationCard extends LitElement {
|
|||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
color: var(--primary-text-color);
|
color: var(--primary-text-color);
|
||||||
}
|
}
|
||||||
a ha-icon-next {
|
|
||||||
color: var(--secondary-text-color);
|
|
||||||
}
|
|
||||||
.icons {
|
.icons {
|
||||||
display: flex;
|
display: flex;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { mdiAlertCircleOutline, mdiAlertOutline } from "@mdi/js";
|
import { mdiAlertCircleOutline, mdiAlertOutline } from "@mdi/js";
|
||||||
import { LitElement, TemplateResult, css, html, nothing } from "lit";
|
import { LitElement, TemplateResult, css, html, nothing } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
|
import "../../../components/ha-icon-next";
|
||||||
import "../../../components/ha-svg-icon";
|
import "../../../components/ha-svg-icon";
|
||||||
import { IntegrationManifest, domainToName } from "../../../data/integration";
|
import { IntegrationManifest, domainToName } from "../../../data/integration";
|
||||||
import { HomeAssistant } from "../../../types";
|
import { HomeAssistant } from "../../../types";
|
||||||
@ -40,27 +41,34 @@ export class HaIntegrationHeader extends LitElement {
|
|||||||
/>
|
/>
|
||||||
<div class="info">
|
<div class="info">
|
||||||
<div
|
<div
|
||||||
class="primary ${this.warning || this.error ? "hasError" : ""}"
|
class="primary ${this.warning || this.error ? "has-secondary" : ""}"
|
||||||
role="heading"
|
role="heading"
|
||||||
aria-level="1"
|
aria-level="1"
|
||||||
>
|
>
|
||||||
${domainName}
|
${domainName}
|
||||||
</div>
|
</div>
|
||||||
${this.error
|
${this.error
|
||||||
? html`<div class="error">
|
? html`
|
||||||
<ha-svg-icon .path=${mdiAlertCircleOutline}></ha-svg-icon>${this
|
<div class="secondary error">
|
||||||
.error}
|
<ha-svg-icon .path=${mdiAlertCircleOutline}></ha-svg-icon>
|
||||||
</div>`
|
<span>${this.error}</span>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
: this.warning
|
: this.warning
|
||||||
? html`<div class="warning">
|
? html`
|
||||||
<ha-svg-icon .path=${mdiAlertOutline}></ha-svg-icon>${this
|
<div class="secondary warning">
|
||||||
.warning}
|
<ha-svg-icon .path=${mdiAlertOutline}></ha-svg-icon>
|
||||||
</div>`
|
<span>${this.warning}</span>
|
||||||
|
</div>
|
||||||
|
`
|
||||||
: nothing}
|
: nothing}
|
||||||
</div>
|
</div>
|
||||||
<div class="header-button">
|
<ha-icon-next
|
||||||
<slot name="header-button"></slot>
|
class="header-button"
|
||||||
</div>
|
.label=${this.hass.localize(
|
||||||
|
"ui.panel.config.integrations.config_entry.configure"
|
||||||
|
)}
|
||||||
|
></ha-icon-next>
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
@ -76,12 +84,15 @@ export class HaIntegrationHeader extends LitElement {
|
|||||||
static styles = css`
|
static styles = css`
|
||||||
.header {
|
.header {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
position: relative;
|
position: relative;
|
||||||
padding-top: 16px;
|
padding-top: 16px;
|
||||||
padding-bottom: 16px;
|
padding-bottom: 16px;
|
||||||
padding-inline-start: 16px;
|
padding-inline-start: 16px;
|
||||||
padding-inline-end: 8px;
|
padding-inline-end: 8px;
|
||||||
direction: var(--direction);
|
direction: var(--direction);
|
||||||
|
box-sizing: border-box;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
.header img {
|
.header img {
|
||||||
margin-inline-start: initial;
|
margin-inline-start: initial;
|
||||||
@ -91,50 +102,55 @@ export class HaIntegrationHeader extends LitElement {
|
|||||||
direction: var(--direction);
|
direction: var(--direction);
|
||||||
}
|
}
|
||||||
.header .info {
|
.header .info {
|
||||||
|
position: relative;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
flex: 1;
|
flex: 1;
|
||||||
align-self: center;
|
align-self: center;
|
||||||
|
min-width: 0;
|
||||||
}
|
}
|
||||||
.primary,
|
ha-icon-next {
|
||||||
.warning,
|
color: var(--secondary-text-color);
|
||||||
.error {
|
|
||||||
word-wrap: break-word;
|
|
||||||
display: -webkit-box;
|
|
||||||
-webkit-box-orient: vertical;
|
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
|
||||||
}
|
}
|
||||||
.primary {
|
.primary {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
display: -webkit-box;
|
||||||
|
-webkit-line-clamp: 2;
|
||||||
|
-webkit-box-orient: vertical;
|
||||||
font-size: 16px;
|
font-size: 16px;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
word-break: break-word;
|
|
||||||
color: var(--primary-text-color);
|
color: var(--primary-text-color);
|
||||||
-webkit-line-clamp: 2;
|
|
||||||
}
|
}
|
||||||
.hasError {
|
.has-secondary {
|
||||||
-webkit-line-clamp: 1;
|
-webkit-line-clamp: 1;
|
||||||
font-size: 14px;
|
font-size: 14px;
|
||||||
}
|
}
|
||||||
.warning,
|
.secondary {
|
||||||
.error {
|
min-width: 0;
|
||||||
line-height: 20px;
|
|
||||||
--mdc-icon-size: 20px;
|
--mdc-icon-size: 20px;
|
||||||
-webkit-line-clamp: 1;
|
-webkit-line-clamp: 1;
|
||||||
font-size: 0.9em;
|
font-size: 12px;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
}
|
||||||
|
.secondary > span {
|
||||||
|
position: relative;
|
||||||
|
flex: 1;
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
.secondary > ha-svg-icon {
|
||||||
|
margin-right: 4px;
|
||||||
|
flex-shrink: 0;
|
||||||
}
|
}
|
||||||
.error ha-svg-icon {
|
.error ha-svg-icon {
|
||||||
margin-right: 4px;
|
|
||||||
color: var(--error-color);
|
color: var(--error-color);
|
||||||
}
|
}
|
||||||
.warning ha-svg-icon {
|
.warning ha-svg-icon {
|
||||||
margin-right: 4px;
|
|
||||||
color: var(--warning-color);
|
color: var(--warning-color);
|
||||||
}
|
}
|
||||||
.header-button {
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
width: 36px;
|
|
||||||
}
|
|
||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user