Allow controlling badge margin via mixin (#289)

* Allow controlling badge margin via mixin

* Move margin-bottom from ha-label-badge to ha-badges-card
This commit is contained in:
Andrey 2017-06-09 06:22:12 +03:00 committed by Paulus Schoutsen
parent 75679e90f2
commit 6a864106e0
3 changed files with 9 additions and 3 deletions

View File

@ -4,6 +4,12 @@
<dom-module id='ha-badges-card'>
<template>
<style>
ha-state-label-badge {
display: inline-block;
margin-bottom: var(--ha-state-label-badge-margin-bottom, 16px);
}
</style>
<template is='dom-repeat' items='[[states]]'>
<ha-state-label-badge hass='[[hass]]' state='[[item]]'></ha-state-label-badge>
</template>

View File

@ -215,7 +215,7 @@
// Find column with < 5 entities, else column with lowest count
function getIndex(size) {
var minIndex = 0;
for (i = minIndex; i < entityCount.length; i++) {
for (i = 0; i < entityCount.length; i++) {
if (entityCount[i] < 5) {
minIndex = i;
break;
@ -229,6 +229,7 @@
return minIndex;
}
if (showIntroduction) {
cards.columns[getIndex(5)].push({
hass: hass,
@ -262,7 +263,7 @@
});
// Add 1 to the size if we're rendering entities card
size += other.length > 1;
size += other.length > 0;
curIndex = getIndex(size);

View File

@ -8,7 +8,6 @@
display: inline-block;
text-align: center;
vertical-align: top;
margin-bottom: 16px;
}
.label-badge {
position: relative;