From fbb43821baf3b1dd9a9b7634cff45c0c342aa848 Mon Sep 17 00:00:00 2001 From: Paulus Schoutsen Date: Thu, 29 Oct 2020 17:56:26 +0100 Subject: [PATCH] Add grid card to the gallery (#7524) --- gallery/src/demos/demo-hui-stack-card.ts | 42 ++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/gallery/src/demos/demo-hui-stack-card.ts b/gallery/src/demos/demo-hui-stack-card.ts index b746888dc1..982eab4f25 100644 --- a/gallery/src/demos/demo-hui-stack-card.ts +++ b/gallery/src/demos/demo-hui-stack-card.ts @@ -1,6 +1,7 @@ import { html } from "@polymer/polymer/lib/utils/html-tag"; /* eslint-plugin-disable lit */ import { PolymerElement } from "@polymer/polymer/polymer-element"; +import { mockHistory } from "../../../demo/src/stubs/history"; import { getEntity } from "../../../src/fake_data/entity"; import { provideHass } from "../../../src/fake_data/provide_hass"; import "../components/demo-cards"; @@ -36,6 +37,10 @@ const ENTITIES = [ battery: 71, friendly_name: "Home Boy", }), + getEntity("sensor", "illumination", "23", { + friendly_name: "Illumination", + unit_of_measurement: "lx", + }), ]; const CONFIGS = [ @@ -89,6 +94,42 @@ const CONFIGS = [ entity: light.bed_light `, }, + { + heading: "Default Grid", + config: ` +- type: grid + cards: + - type: entity + entity: light.kitchen_lights + - type: entity + entity: light.bed_light + - type: entity + entity: device_tracker.demo_paulus + - type: sensor + entity: sensor.illumination + graph: line + - type: entity + entity: device_tracker.demo_anne_therese + `, + }, + { + heading: "Non-square Grid with 2 columns", + config: ` +- type: grid + columns: 2 + square: false + cards: + - type: entity + entity: light.kitchen_lights + - type: entity + entity: light.bed_light + - type: entity + entity: device_tracker.demo_paulus + - type: sensor + entity: sensor.illumination + graph: line + `, + }, ]; class DemoStack extends PolymerElement { @@ -110,6 +151,7 @@ class DemoStack extends PolymerElement { const hass = provideHass(this.$.demos); hass.updateTranslations(null, "en"); hass.addEntities(ENTITIES); + mockHistory(hass); } }