mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
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:
parent
75679e90f2
commit
6a864106e0
@ -4,6 +4,12 @@
|
|||||||
|
|
||||||
<dom-module id='ha-badges-card'>
|
<dom-module id='ha-badges-card'>
|
||||||
<template>
|
<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]]'>
|
<template is='dom-repeat' items='[[states]]'>
|
||||||
<ha-state-label-badge hass='[[hass]]' state='[[item]]'></ha-state-label-badge>
|
<ha-state-label-badge hass='[[hass]]' state='[[item]]'></ha-state-label-badge>
|
||||||
</template>
|
</template>
|
||||||
|
@ -215,7 +215,7 @@
|
|||||||
// Find column with < 5 entities, else column with lowest count
|
// Find column with < 5 entities, else column with lowest count
|
||||||
function getIndex(size) {
|
function getIndex(size) {
|
||||||
var minIndex = 0;
|
var minIndex = 0;
|
||||||
for (i = minIndex; i < entityCount.length; i++) {
|
for (i = 0; i < entityCount.length; i++) {
|
||||||
if (entityCount[i] < 5) {
|
if (entityCount[i] < 5) {
|
||||||
minIndex = i;
|
minIndex = i;
|
||||||
break;
|
break;
|
||||||
@ -229,6 +229,7 @@
|
|||||||
|
|
||||||
return minIndex;
|
return minIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showIntroduction) {
|
if (showIntroduction) {
|
||||||
cards.columns[getIndex(5)].push({
|
cards.columns[getIndex(5)].push({
|
||||||
hass: hass,
|
hass: hass,
|
||||||
@ -262,7 +263,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// Add 1 to the size if we're rendering entities card
|
// Add 1 to the size if we're rendering entities card
|
||||||
size += other.length > 1;
|
size += other.length > 0;
|
||||||
|
|
||||||
curIndex = getIndex(size);
|
curIndex = getIndex(size);
|
||||||
|
|
||||||
|
@ -8,7 +8,6 @@
|
|||||||
display: inline-block;
|
display: inline-block;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
vertical-align: top;
|
vertical-align: top;
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
}
|
||||||
.label-badge {
|
.label-badge {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user