Fix name styling (#1522)

* Fix name styling

* Update hui-glance-card.js

* Demo

* Update demo-hui-glance-card.js

* Update hui-glance-card.js
This commit is contained in:
quthla 2018-07-26 00:56:25 +02:00 committed by c727
parent 36ba37c59c
commit e458cf1388
2 changed files with 18 additions and 1 deletions

View File

@ -127,6 +127,20 @@ const CONFIGS = [
- light.kitchen_lights - light.kitchen_lights
` `
}, },
{
heading: 'Selectively hidden name',
config: `
- type: glance
entities:
- device_tracker.demo_paulus
- entity: media_player.living_room
name:
- sun.sun
- entity: cover.kitchen_window
name:
- light.kitchen_lights
`
},
]; ];
class DemoPicEntity extends PolymerElement { class DemoPicEntity extends PolymerElement {

View File

@ -54,6 +54,9 @@ class HuiGlanceCard extends LocalizeMixin(EventsMixin(PolymerElement)) {
overflow: hidden; overflow: hidden;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
.name {
min-height: var(--paper-font-body1_-_line-height, 20px);
}
</style> </style>
<ha-card header$="[[_config.title]]"> <ha-card header$="[[_config.title]]">
@ -62,7 +65,7 @@ class HuiGlanceCard extends LocalizeMixin(EventsMixin(PolymerElement)) {
<template is="dom-if" if="[[_showEntity(item, hass.states)]]"> <template is="dom-if" if="[[_showEntity(item, hass.states)]]">
<div class="entity" on-click="_handleClick"> <div class="entity" on-click="_handleClick">
<template is="dom-if" if="[[_showInfo(_config.show_name)]]"> <template is="dom-if" if="[[_showInfo(_config.show_name)]]">
<div>[[_computeName(item, hass.states)]]</div> <div class="name">[[_computeName(item, hass.states)]]</div>
</template> </template>
<template is="dom-if" if="[[!item.icon]]"> <template is="dom-if" if="[[!item.icon]]">
<state-badge state-obj="[[_computeStateObj(item, hass.states)]]"></state-badge> <state-badge state-obj="[[_computeStateObj(item, hass.states)]]"></state-badge>