Limit demo card mobile (#3281)

* Limit demo card on mobile

* Remove unused deps

* Remove tabs from ARS demo

* Set title to Home Assistant
This commit is contained in:
Paulus Schoutsen 2019-06-18 10:44:11 -07:00 committed by GitHub
parent a9320d4baf
commit d8e0fd0ba5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 2062 deletions

File diff suppressed because it is too large Load Diff

View File

@ -6,12 +6,9 @@ import {
PropertyDeclarations, PropertyDeclarations,
} from "lit-element"; } from "lit-element";
import { until } from "lit-html/directives/until"; import { until } from "lit-html/directives/until";
import "@polymer/paper-icon-button";
import "@material/mwc-button"; import "@material/mwc-button";
import "@polymer/paper-spinner/paper-spinner-lite"; import "@polymer/paper-spinner/paper-spinner-lite";
import "../../../src/components/ha-card"; import "../../../src/components/ha-card";
import "../../../src/components/ha-paper-icon-button-next";
import "../../../src/components/ha-paper-icon-button-prev";
import { LovelaceCard, Lovelace } from "../../../src/panels/lovelace/types"; import { LovelaceCard, Lovelace } from "../../../src/panels/lovelace/types";
import { LovelaceCardConfig } from "../../../src/data/lovelace"; import { LovelaceCardConfig } from "../../../src/data/lovelace";
import { MockHomeAssistant } from "../../../src/fake_data/provide_hass"; import { MockHomeAssistant } from "../../../src/fake_data/provide_hass";
@ -49,11 +46,7 @@ export class HADemoCard extends LitElement implements LovelaceCard {
return html` return html`
<ha-card> <ha-card>
<div class="picker"> <div class="picker">
<ha-paper-icon-button-prev <div class="label">
@click=${this._prevConfig}
.disabled=${this._switching}
></ha-paper-icon-button-prev>
<div>
${this._switching ${this._switching
? html` ? html`
<paper-spinner-lite active></paper-spinner-lite> <paper-spinner-lite active></paper-spinner-lite>
@ -73,16 +66,15 @@ export class HADemoCard extends LitElement implements LovelaceCard {
"" ""
)} )}
</div> </div>
<ha-paper-icon-button-next <mwc-button @click=${this._nextConfig} .disabled=${this._switching}>
@click=${this._nextConfig} Next demo
.disabled=${this._switching} </mwc-button>
></ha-paper-icon-button-next>
</div> </div>
<div class="content"> <div class="content small-hidden">
Welcome home! You've reached the Home Assistant demo where we showcase Welcome home! You've reached the Home Assistant demo where we showcase
the best UIs created by our community. the best UIs created by our community.
</div> </div>
<div class="actions"> <div class="actions small-hidden">
<a href="https://www.home-assistant.io" target="_blank"> <a href="https://www.home-assistant.io" target="_blank">
<mwc-button>Learn more about Home Assistant</mwc-button> <mwc-button>Learn more about Home Assistant</mwc-button>
</a> </a>
@ -91,14 +83,6 @@ export class HADemoCard extends LitElement implements LovelaceCard {
`; `;
} }
private _prevConfig() {
this._updateConfig(
selectedDemoConfigIndex > 0
? selectedDemoConfigIndex - 1
: demoConfigs.length - 1
);
}
private _nextConfig() { private _nextConfig() {
this._updateConfig( this._updateConfig(
selectedDemoConfigIndex < demoConfigs.length - 1 selectedDemoConfigIndex < demoConfigs.length - 1
@ -125,6 +109,10 @@ export class HADemoCard extends LitElement implements LovelaceCard {
color: var(--primary-color); color: var(--primary-color);
} }
.actions a {
text-decoration: none;
}
.content { .content {
padding: 16px; padding: 16px;
} }
@ -136,17 +124,27 @@ export class HADemoCard extends LitElement implements LovelaceCard {
height: 60px; height: 60px;
} }
.picker div { .picker mwc-button {
text-align: center; margin-right: 8px;
} }
.picker small { .label {
padding-left: 16px;
}
.label small {
display: block; display: block;
} }
.actions { .actions {
padding-left: 8px; padding-left: 8px;
} }
@media only screen and (max-width: 500px) {
.small-hidden {
display: none;
}
}
`, `,
]; ];
} }

View File

@ -87,7 +87,7 @@
#ha-init-skeleton::before { #ha-init-skeleton::before {
display: block; display: block;
content: ""; content: "";
height: 112px; height: 64px;
background-color: #03a9f4; background-color: #03a9f4;
} }
</style> </style>