improves design and adds status bar to cover

This commit is contained in:
Mathias Scherer 2021-04-05 13:14:30 +02:00
parent fcc4430bf9
commit 01f04f5db5
No known key found for this signature in database
GPG Key ID: 6A618EAA2BC2C1E5
2 changed files with 40 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#MMM-HomeAssistant-Touch { #MMM-HomeAssistant-Touch {
display: flex; display: flex;
justify-content: center; justify-content: center;
flex-wrap: wrap;
} }
#MMM-HomeAssistant-Touch .ha-entity { #MMM-HomeAssistant-Touch .ha-entity {
@ -8,6 +9,9 @@
border-radius: 0.5rem; border-radius: 0.5rem;
padding: 0.5rem; padding: 0.5rem;
margin: 0.5rem; margin: 0.5rem;
height: 7rem;
width: 7rem;
font-size: 18px;
} }
#MMM-HomeAssistant-Touch .ha-entity .title, #MMM-HomeAssistant-Touch .ha-entity .title,
@ -20,6 +24,26 @@
background-color: #2af20261; background-color: #2af20261;
} }
#MMM-HomeAssistant-Touch .ha-entity.ha-cover {
padding: 0;
padding-left: .5rem;
height: 8rem;
display: flex;
}
#MMM-HomeAssistant-Touch .ha-entity.ha-cover .title{
flex-grow: 1;
}
#MMM-HomeAssistant-Touch .ha-entity.ha-cover .status {
width: .5rem;
background-color: #2af20261;
border-bottom-right-radius: 0.4rem;
align-self: flex-end;
z-index: -1;
}
#MMM-HomeAssistant-Touch .ha-entity.ha-cover .status.full {
border-top-right-radius: 0.4rem;
}
.ha-slider { .ha-slider {
width: 3rem; width: 3rem;
height: 200px; height: 200px;

View File

@ -11,4 +11,20 @@ class Cover extends Slider {
position: this.sliderState, position: this.sliderState,
}); });
} }
render() {
super.render()
const container = document.getElementById(this.id)
if(container) {
const status = document.createElement('div')
status.classList.add('status')
status.style.height = `${this.state}%`
if(this.state === 100) {
status.classList.add('full')
}
container.appendChild(status)
}
}
} }