Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert ha-card to LitElement and TypeScript #2701

Merged
merged 4 commits into from Feb 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
42 changes: 0 additions & 42 deletions src/components/ha-card.js

This file was deleted.

45 changes: 45 additions & 0 deletions src/components/ha-card.ts
@@ -0,0 +1,45 @@
import {
css,
CSSResult,
html,
LitElement,
property,
TemplateResult,
} from "lit-element";

class HaCard extends LitElement {
@property() public header?: string;

static get styles(): CSSResult {
return css`
:host {
background: var(
--ha-card-background,
var(--paper-card-background-color, white)
);
border-radius: var(--ha-card-border-radius, 2px);
box-shadow: 0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 1px 5px 0 rgba(0, 0, 0, 0.12), 0 3px 1px -2px rgba(0, 0, 0, 0.2);
color: var(--primary-text-color);
display: block;
transition: all 0.3s ease-out;
}
.header:not(:empty) {
thomasloven marked this conversation as resolved.
Show resolved Hide resolved
font-size: 24px;
letter-spacing: -0.012em;
line-height: 32px;
opacity: 0.87;
padding: 24px 16px 16px;
}
`;
}

protected render(): TemplateResult {
return html`
<div class="header">${this.header}</div>
<slot></slot>
`;
}
}

customElements.define("ha-card", HaCard);