TileBoard icon indicating copy to clipboard operation
TileBoard copied to clipboard

Gauge tile padding issue

Open alphasixtyfive opened this issue 3 years ago • 11 comments

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

alphasixtyfive avatar Apr 14 '21 20:04 alphasixtyfive

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.

rchl avatar Apr 14 '21 21:04 rchl

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

alphasixtyfive avatar Apr 14 '21 21:04 alphasixtyfive

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

alphasixtyfive avatar Apr 14 '21 21:04 alphasixtyfive

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".)

akloeckner avatar Apr 15 '21 12:04 akloeckner

@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.

alphasixtyfive avatar Apr 15 '21 13:04 alphasixtyfive

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.

akloeckner avatar Apr 15 '21 13:04 akloeckner

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.

alphasixtyfive avatar Apr 15 '21 13:04 alphasixtyfive

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

Can we do the following?

  • Re-model class="item" to use flex-box.
  • Make sure that class="item-entity-container" still is positioned absolutely, such that legacy item TYPEs keep working as is.
  • Switch the gauge tile to something like class="item-entity-container-flex" and start going from there.
  • Do the same for the sensor tile. And continuously migrate as necessary.

akloeckner avatar Apr 16 '21 08:04 akloeckner

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

alphasixtyfive avatar Apr 16 '21 09:04 alphasixtyfive

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

rchl avatar Apr 16 '21 09:04 rchl

@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.

akloeckner avatar Apr 19 '21 12:04 akloeckner