resoai / TileBoard

A simple yet highly configurable Dashboard for HomeAssistant
MIT License
1.63k stars 278 forks source link

Gauge tile padding issue #698

Open alphasixtyfive opened 3 years ago

alphasixtyfive commented 3 years ago

As of now we have a fixed top padding of 10px for gauge tile which sadly is something that does not work with most of the tile sizes and almost always overlaps with the state. Here are two examples with gauge size set to 160 and 120:

size-160 size-120

Those would look OK with padding set to 20px for size 160 and 30px for size 120:

size-160-20px size-120--30px
rchl commented 3 years ago

Would likely get fixed by switching to flexbox (we would reserve space for state, if present), but of course, we might want some quick-fix for the time being.

alphasixtyfive commented 3 years ago

Yeah, I was thinking about flexbox and wanted to reference it in #682. Flexbox will clearly be a big job.

alphasixtyfive commented 3 years ago

I've also noticed that if you restart HA, gauge disappears, leaving only the value.

akloeckner commented 3 years ago

Isn't the state fixed-size through top and font-size here? https://github.com/resoai/TileBoard/blob/6c2a3dfc1863aa4123b81ec255bbf5f4d8b40477/styles/main.less#L771

That would mean, the top padding would only need to be set to be "bigger" than the height of the state...

(In that course, the state's top could also be fixed to be same as its right, since right now, it's not "symmetrical".)

alphasixtyfive commented 3 years ago

@akloeckner It is not only state overlapping which is the issue I'm afraid. Larger tiles with smaller gauges like the ones in my second example we would still need to more or less center gauge vertically to make it look good. A quick and dirty fix would probably be setting top padding in the code which would depend on cause size and top/bottom offsets or something like that.

akloeckner commented 3 years ago

we would still need to more or less center gauge vertically

I see... :-/ Then, I have no simple solution in my mind.

Just a hint: I'd try to reduce setting css from the code to a minimum (best-case: zero). I experienced the mess it causes, when implementing the full-size popups. I'd favor classes and pure css (overwritable from custom.css) instead.

alphasixtyfive commented 3 years ago

we would still need to more or less center gauge vertically

I see... :-/ Then, I have no simple solution in my mind.

Just a hint: I'd try to reduce setting css from the code to a minimum (best-case: zero). I experienced the mess it causes, when implementing the full-size popups. I'd favor classes and pure css (overwritable from custom.css) instead.

That I fully agree with.

akloeckner commented 3 years ago

Looking at it again: https://github.com/resoai/TileBoard/blob/master/scripts/directives/tile.html

Can we do the following?

alphasixtyfive commented 3 years ago

@akloeckner @rchl how about class="item -flex" ?

rchl commented 3 years ago

I think it also requires more markup changes. We should probably wait with refactoring until we have no pending PRs.

akloeckner commented 3 years ago

@akloeckner @rchl how about class="item -flex" ?

I found that good, until I noticed: We would need to programmatically set the -flex class for selective item types. The first point to separate item types in the markup is the item-entity-container.