Update style

This commit is contained in:
Zack Arnett 2020-09-06 01:10:51 -05:00
parent 5b031f46f2
commit 9e60e36a7e
5 changed files with 298 additions and 279 deletions

View File

@ -4,13 +4,13 @@ import { html } from "@polymer/polymer/lib/utils/html-tag";
/* eslint-plugin-disable lit */ /* eslint-plugin-disable lit */
import { PolymerElement } from "@polymer/polymer/polymer-element"; import { PolymerElement } from "@polymer/polymer/polymer-element";
import { formatDateTime } from "../../../../common/datetime/format_date_time"; import { formatDateTime } from "../../../../common/datetime/format_date_time";
import { computeRTLDirection } from "../../../../common/util/compute_rtl";
import "../../../../components/buttons/ha-call-api-button"; import "../../../../components/buttons/ha-call-api-button";
import "../../../../components/ha-card"; import "../../../../components/ha-card";
import { fetchCloudSubscriptionInfo } from "../../../../data/cloud"; import { fetchCloudSubscriptionInfo } from "../../../../data/cloud";
import "../../../../layouts/hass-subpage"; import "../../../../layouts/hass-subpage";
import { EventsMixin } from "../../../../mixins/events-mixin"; import { EventsMixin } from "../../../../mixins/events-mixin";
import LocalizeMixin from "../../../../mixins/localize-mixin"; import LocalizeMixin from "../../../../mixins/localize-mixin";
import { computeRTLDirection } from "../../../../common/util/compute_rtl";
import "../../../../styles/polymer-ha-style"; import "../../../../styles/polymer-ha-style";
import "../../ha-config-section"; import "../../ha-config-section";
import "./cloud-alexa-pref"; import "./cloud-alexa-pref";
@ -131,7 +131,7 @@ class CloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
</ha-card> </ha-card>
</ha-config-section> </ha-config-section>
<ha-config-section is-wide="[[isWide]]"> <ha-config-section side-by-side is-wide="[[isWide]]">
<span slot="header" <span slot="header"
>[[localize('ui.panel.config.cloud.account.integrations')]]</span >[[localize('ui.panel.config.cloud.account.integrations')]]</span
> >
@ -150,13 +150,14 @@ class CloudAccount extends EventsMixin(LocalizeMixin(PolymerElement)) {
>. >.
</p> </p>
</div> </div>
<div class$="integrations [[_computeIsNarrow(isWide)]]">
<cloud-remote-pref <cloud-remote-pref
hass="[[hass]]" hass="[[hass]]"
cloud-status="[[cloudStatus]]" cloud-status="[[cloudStatus]]"
dir="[[_rtlDirection]]" dir="[[_rtlDirection]]"
></cloud-remote-pref> ></cloud-remote-pref>
</ha-config-section>
<ha-config-section no-header is-wide="[[isWide]]">
<div class$="integrations [[_computeIsNarrow(isWide)]]">
<cloud-alexa-pref <cloud-alexa-pref
hass="[[hass]]" hass="[[hass]]"
cloud-status="[[cloudStatus]]" cloud-status="[[cloudStatus]]"

View File

@ -1,18 +1,16 @@
import { import {
LitElement,
CSSResult,
css, css,
CSSResult,
customElement,
html, html,
LitElement,
property, property,
TemplateResult, TemplateResult,
customElement,
} from "lit-element"; } from "lit-element";
import type { HomeAssistant } from "../../../types"; import type { HomeAssistant } from "../../../types";
import "../ha-config-section"; import "../ha-config-section";
import "./ha-config-name-form";
import "./ha-config-core-form"; import "./ha-config-core-form";
import "./ha-config-name-form";
import "./ha-config-url-form"; import "./ha-config-url-form";
@customElement("ha-config-section-core") @customElement("ha-config-section-core")
@ -27,16 +25,14 @@ export class HaConfigSectionCore extends LitElement {
protected render(): TemplateResult { protected render(): TemplateResult {
return html` return html`
<ha-config-section .isWide=${this.isWide}> <ha-config-section .isWide=${this.isWide}>
<span slot="header" <div slot="header">
>${this.hass.localize( ${this.hass.localize("ui.panel.config.core.section.core.header")}
"ui.panel.config.core.section.core.header" </div>
)}</span <div slot="introduction">
> ${this.hass.localize(
<span slot="introduction"
>${this.hass.localize(
"ui.panel.config.core.section.core.introduction" "ui.panel.config.core.section.core.introduction"
)}</span )}
> </div>
<div class="content"> <div class="content">
<ha-config-name-form .hass=${this.hass}></ha-config-name-form> <ha-config-name-form .hass=${this.hass}></ha-config-name-form>
<ha-config-url-form .hass=${this.hass}></ha-config-url-form> <ha-config-url-form .hass=${this.hass}></ha-config-url-form>

View File

@ -1,4 +1,4 @@
import "../../../layouts/ha-app-layout"; import { mdiCloudLock } from "@mdi/js";
import "@polymer/app-layout/app-header/app-header"; import "@polymer/app-layout/app-header/app-header";
import "@polymer/app-layout/app-toolbar/app-toolbar"; import "@polymer/app-layout/app-toolbar/app-toolbar";
import { import {
@ -15,12 +15,12 @@ import "../../../components/ha-card";
import "../../../components/ha-icon-next"; import "../../../components/ha-icon-next";
import "../../../components/ha-menu-button"; import "../../../components/ha-menu-button";
import { CloudStatus } from "../../../data/cloud"; import { CloudStatus } from "../../../data/cloud";
import "../../../layouts/ha-app-layout";
import { haStyle } from "../../../resources/styles"; import { haStyle } from "../../../resources/styles";
import { HomeAssistant } from "../../../types"; import { HomeAssistant } from "../../../types";
import "../ha-config-section"; import "../ha-config-section";
import { configSections } from "../ha-panel-config"; import { configSections } from "../ha-panel-config";
import "./ha-config-navigation"; import "./ha-config-navigation";
import { mdiCloudLock } from "@mdi/js";
@customElement("ha-config-dashboard") @customElement("ha-config-dashboard")
class HaConfigDashboard extends LitElement { class HaConfigDashboard extends LitElement {
@ -36,10 +36,8 @@ class HaConfigDashboard extends LitElement {
@property() public showAdvanced!: boolean; @property() public showAdvanced!: boolean;
protected render(): TemplateResult { protected render(): TemplateResult {
const content = html` <ha-config-section const content = html`
.narrow=${this.narrow} <ha-config-section .narrow=${this.narrow}>
.isWide=${this.isWide}
>
<div slot="header"> <div slot="header">
${this.hass.localize("ui.panel.config.header")} ${this.hass.localize("ui.panel.config.header")}
</div> </div>
@ -111,7 +109,9 @@ class HaConfigDashboard extends LitElement {
${!this.showAdvanced ${!this.showAdvanced
? html` ? html`
<div class="promo-advanced"> <div class="promo-advanced">
${this.hass.localize("ui.panel.config.advanced_mode.hint_enable")} ${this.hass.localize(
"ui.panel.config.advanced_mode.hint_enable"
)}
<a href="/profile" <a href="/profile"
>${this.hass.localize( >${this.hass.localize(
"ui.panel.config.advanced_mode.link_profile_page" "ui.panel.config.advanced_mode.link_profile_page"
@ -120,7 +120,8 @@ class HaConfigDashboard extends LitElement {
</div> </div>
` `
: ""} : ""}
</ha-config-section>`; </ha-config-section>
`;
if (!this.narrow && this.hass.dockedSidebar !== "always_hidden") { if (!this.narrow && this.hass.dockedSidebar !== "always_hidden") {
return content; return content;

View File

@ -5,11 +5,16 @@ import { classMap } from "lit-html/directives/class-map";
export class HaConfigSection extends LitElement { export class HaConfigSection extends LitElement {
@property({ type: Boolean }) public isWide = false; @property({ type: Boolean }) public isWide = false;
@property({ type: Boolean }) public narrow?: boolean;
@property({ type: Boolean, attribute: "no-header" }) public noHeader = false;
protected render() { protected render() {
return html` return html`
<div <div
class="content ${classMap({ class="content ${classMap({
narrow: !this.isWide, narrow: this.narrow !== undefined ? this.narrow : !this.isWide,
"no-header": this.noHeader,
})}" })}"
> >
<div class="heading"> <div class="heading">
@ -65,11 +70,12 @@ export class HaConfigSection extends LitElement {
} }
:host([side-by-side]) .content:not(.narrow) .heading { :host([side-by-side]) .content:not(.narrow) .heading {
min-width: 400px;
max-width: 400px; max-width: 400px;
margin-right: 40px; margin-right: 40px;
} }
.header { slot[name="header"]::slotted(*) {
font-family: var(--paper-font-headline_-_font-family); font-family: var(--paper-font-headline_-_font-family);
-webkit-font-smoothing: var( -webkit-font-smoothing: var(
--paper-font-headline_-_-webkit-font-smoothing --paper-font-headline_-_-webkit-font-smoothing
@ -86,7 +92,7 @@ export class HaConfigSection extends LitElement {
margin-top: 32px; margin-top: 32px;
} }
.intro { slot[name="introduction"]::slotted(*) {
font-family: var(--paper-font-subhead_-_font-family); font-family: var(--paper-font-subhead_-_font-family);
-webkit-font-smoothing: var( -webkit-font-smoothing: var(
--paper-font-subhead_-_-webkit-font-smoothing --paper-font-subhead_-_-webkit-font-smoothing
@ -115,11 +121,15 @@ export class HaConfigSection extends LitElement {
.narrow .together { .narrow .together {
margin-top: 20px; margin-top: 20px;
} }
.narrow .intro { .narrow slot[name="introduction"]::slotted(*) {
padding-bottom: 20px; padding-bottom: 20px;
margin-right: 0; margin-right: 0;
max-width: 500px; max-width: 500px;
} }
.no-header.content {
padding-top: 0;
}
`; `;
} }
} }

View File

@ -1,27 +1,27 @@
import "@material/mwc-button";
import "@polymer/app-layout/app-header/app-header"; import "@polymer/app-layout/app-header/app-header";
import "@polymer/app-layout/app-toolbar/app-toolbar"; import "@polymer/app-layout/app-toolbar/app-toolbar";
import "../../../layouts/hass-tabs-subpage"; import "@polymer/paper-input/paper-input";
import { configSections } from "../ha-panel-config";
import { import {
LitElement,
property,
internalProperty,
customElement,
html,
css, css,
CSSResult, CSSResult,
customElement,
html,
internalProperty,
LitElement,
property,
TemplateResult, TemplateResult,
} from "lit-element"; } from "lit-element";
import { HomeAssistant, Route } from "../../../types"; import { classMap } from "lit-html/directives/class-map";
import "@material/mwc-button";
import "@polymer/paper-input/paper-input";
import { isServiceLoaded } from "../../../common/config/is_service_loaded"; import { isServiceLoaded } from "../../../common/config/is_service_loaded";
import "../../../components/buttons/ha-call-service-button"; import "../../../components/buttons/ha-call-service-button";
import "../../../components/ha-card"; import "../../../components/ha-card";
import "../ha-config-section";
import { haStyle } from "../../../resources/styles";
import { checkCoreConfig } from "../../../data/core"; import { checkCoreConfig } from "../../../data/core";
import "../../../layouts/hass-tabs-subpage";
import { haStyle } from "../../../resources/styles";
import { HomeAssistant, Route } from "../../../types";
import "../ha-config-section";
import { configSections } from "../ha-panel-config";
const reloadableDomains = [ const reloadableDomains = [
"group", "group",
@ -80,14 +80,17 @@ export class HaConfigServerControl extends LitElement {
.tabs=${configSections.general} .tabs=${configSections.general}
.showAdvanced=${this.showAdvanced} .showAdvanced=${this.showAdvanced}
> >
<div class="heading"> <ha-config-section
<div class="header"> ?side-by-side=${!this.showAdvanced}
.narrow=${this.narrow}
.isWide=${this.isWide}
>
<div slot="header">
${this.hass.localize("ui.panel.config.server_control.caption")} ${this.hass.localize("ui.panel.config.server_control.caption")}
</div> </div>
<div class="description"> <div slot="introduction">
${this.hass.localize("ui.panel.config.server_control.description")} ${this.hass.localize("ui.panel.config.server_control.description")}
</div> </div>
</div>
<div class="content"> <div class="content">
${this.showAdvanced ${this.showAdvanced
? html` ? html`
@ -157,7 +160,9 @@ export class HaConfigServerControl extends LitElement {
: ""} : ""}
<ha-card <ha-card
class="server-management-card" class="server-management-card ${classMap({
"no-advanced": !this.showAdvanced,
})}"
header=${this.hass.localize( header=${this.hass.localize(
"ui.panel.config.server_control.section.server_management.heading" "ui.panel.config.server_control.section.server_management.heading"
)} )}
@ -200,7 +205,14 @@ export class HaConfigServerControl extends LitElement {
</ha-call-service-button> </ha-call-service-button>
</div> </div>
</ha-card> </ha-card>
</div>
</ha-config-section>
<ha-config-section
no-header
.narrow=${this.narrow}
.isWide=${this.isWide}
>
<div class="content">
${this.showAdvanced ${this.showAdvanced
? html` ? html`
<ha-card <ha-card
@ -246,6 +258,7 @@ export class HaConfigServerControl extends LitElement {
` `
: ""} : ""}
</div> </div>
</ha-config-section>
</hass-tabs-subpage> </hass-tabs-subpage>
`; `;
} }
@ -268,8 +281,7 @@ export class HaConfigServerControl extends LitElement {
return [ return [
haStyle, haStyle,
css` css`
.heading, .heading {
.content {
max-width: 1040px; max-width: 1040px;
margin: 0px auto; margin: 0px auto;
} }
@ -279,7 +291,6 @@ export class HaConfigServerControl extends LitElement {
} }
.content { .content {
padding: 16px 20px 16px;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
justify-content: space-between; justify-content: space-between;
@ -359,7 +370,8 @@ export class HaConfigServerControl extends LitElement {
} }
:host([narrow]) .validate-card, :host([narrow]) .validate-card,
:host([narrow]) .server-management-card { :host([narrow]) .server-management-card,
.server-management-card.no-advanced {
width: 100%; width: 100%;
} }
@ -369,9 +381,8 @@ export class HaConfigServerControl extends LitElement {
:host([narrow]) .reload ha-call-service-button { :host([narrow]) .reload ha-call-service-button {
width: 100%; width: 100%;
margin: 0; margin: 8px 0;
border: none; border: none;
border-top: 1px solid var(--divider-color, #e8e8e8);
} }
`, `,
]; ];