Changes ha-card to new material design rules (#6137)

This commit is contained in:
Bram Kragten 2020-06-10 12:01:37 +02:00 committed by GitHub
parent 0b16a4880a
commit 26a87e9280
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 23 additions and 13 deletions

View File

@ -12,6 +12,8 @@ import {
class HaCard extends LitElement { class HaCard extends LitElement {
@property() public header?: string; @property() public header?: string;
@property({ type: Boolean, reflect: true }) public outlined = false;
static get styles(): CSSResult { static get styles(): CSSResult {
return css` return css`
:host { :host {
@ -19,12 +21,12 @@ class HaCard extends LitElement {
--ha-card-background, --ha-card-background,
var(--paper-card-background-color, white) var(--paper-card-background-color, white)
); );
border-radius: var(--ha-card-border-radius, 2px); border-radius: var(--ha-card-border-radius, 4px);
box-shadow: var( box-shadow: var(
--ha-card-box-shadow, --ha-card-box-shadow,
0 2px 2px 0 rgba(0, 0, 0, 0.14), 0px 2px 1px -1px rgba(0, 0, 0, 0.2),
0 1px 5px 0 rgba(0, 0, 0, 0.12), 0px 1px 1px 0px rgba(0, 0, 0, 0.14),
0 3px 1px -2px rgba(0, 0, 0, 0.2) 0px 1px 3px 0px rgba(0, 0, 0, 0.12)
); );
color: var(--primary-text-color); color: var(--primary-text-color);
display: block; display: block;
@ -32,6 +34,16 @@ class HaCard extends LitElement {
position: relative; position: relative;
} }
:host([outlined]) {
box-shadow: 0 0 0 0;
border-width: 1px;
border-style: solid;
border-color: var(
--ha-card-border-color,
var(--divider-color, #e0e0e0)
);
}
.card-header, .card-header,
:host ::slotted(.card-header) { :host ::slotted(.card-header) {
color: var(--ha-card-header-color, --primary-text-color); color: var(--ha-card-header-color, --primary-text-color);

View File

@ -299,7 +299,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
${this._showIgnored ${this._showIgnored
? ignoredConfigEntries.map( ? ignoredConfigEntries.map(
(item: ConfigEntryExtended) => html` (item: ConfigEntryExtended) => html`
<ha-card class="ignored"> <ha-card outlined class="ignored">
<div class="header"> <div class="header">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.ignore.ignored" "ui.panel.config.integrations.ignore.ignored"
@ -335,7 +335,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
${configEntriesInProgress.length ${configEntriesInProgress.length
? configEntriesInProgress.map( ? configEntriesInProgress.map(
(flow: DataEntryFlowProgressExtended) => html` (flow: DataEntryFlowProgressExtended) => html`
<ha-card class="discovered"> <ha-card outlined class="discovered">
<div class="header"> <div class="header">
${this.hass.localize( ${this.hass.localize(
"ui.panel.config.integrations.discovered" "ui.panel.config.integrations.discovered"
@ -396,7 +396,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
) )
: !this._configEntries.length : !this._configEntries.length
? html` ? html`
<ha-card> <ha-card outlined>
<div class="card-content"> <div class="card-content">
<h1> <h1>
${this.hass.localize("ui.panel.config.integrations.none")} ${this.hass.localize("ui.panel.config.integrations.none")}
@ -613,7 +613,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
justify-content: space-between; justify-content: space-between;
} }
.discovered { .discovered {
border: 1px solid var(--primary-color); --ha-card-border-color: var(--primary-color);
} }
.discovered .header { .discovered .header {
background: var(--primary-color); background: var(--primary-color);
@ -622,7 +622,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
text-align: center; text-align: center;
} }
.ignored { .ignored {
border: 1px solid var(--light-theme-disabled-color); --ha-card-border-color: var(--light-theme-disabled-color);
} }
.ignored img { .ignored img {
filter: grayscale(1); filter: grayscale(1);

View File

@ -76,7 +76,7 @@ export class HaIntegrationCard extends LitElement {
private _renderGroupedIntegration(): TemplateResult { private _renderGroupedIntegration(): TemplateResult {
return html` return html`
<ha-card class="group"> <ha-card outlined class="group">
<div class="group-header"> <div class="group-header">
<img <img
src="https://brands.home-assistant.io/${this.domain}/icon.png" src="https://brands.home-assistant.io/${this.domain}/icon.png"
@ -112,6 +112,7 @@ export class HaIntegrationCard extends LitElement {
const entities = this._getEntities(item); const entities = this._getEntities(item);
return html` return html`
<ha-card <ha-card
outlined
class="single integration" class="single integration"
.configEntry=${item} .configEntry=${item}
.id=${item.entry_id} .id=${item.entry_id}

View File

@ -109,9 +109,6 @@ export class HuiCardOptions extends LitElement {
ha-card { ha-card {
border-top-right-radius: 0; border-top-right-radius: 0;
border-top-left-radius: 0; border-top-left-radius: 0;
box-shadow: rgba(0, 0, 0, 0.14) 0px 2px 2px 0px,
rgba(0, 0, 0, 0.12) 0px 1px 5px -4px,
rgba(0, 0, 0, 0.2) 0px 3px 1px -2px;
} }
div.options { div.options {