UI icon indicating copy to clipboard operation
UI copied to clipboard

Move away from using px and instead use vw for styling

Open mlittle408 opened this issue 4 years ago • 8 comments

Have you considered using vw instead of px (for font sizes, padding, etc) in the button card template (and theme file)? It would make the it a lot more responsive and would allow you to use one theme file for desktop, tablet and mobile. I am working on a layout that works on my desktop and kiosk tablet and am running into issues related to sizing. The stumbling block is the reliance on px instead of vw. Is that something you're considering? I didn't want to have to modify the button card template for my situation, if I can avoid it.

You can also use vmin and vmax for fonts if you want to limit the smallest and largest sizes. Just a thought.

mlittle408 avatar Dec 21 '21 23:12 mlittle408

Yes, good idea.

Can you contribute to this? I'm happy to help you integrate the changes if you have any questions but my knowledge on vw and px is fairly limited.

bavo avatar Dec 22 '21 11:12 bavo

TIL there's more than px, sp and percentage for setting size😀

saxel avatar Dec 22 '21 13:12 saxel

Yes, I'd be happy to work on it 😀

mlittle408 avatar Dec 22 '21 13:12 mlittle408

@mlittle408 If you haven't implemented something on your end yet I'd suggest to work with variables to have some proper framework in place instead of just converting everything to responsive units. That way new cards are properly done out of the box.

To keep it simple, I would suggest the following variables, any thoughts?

space-xs: "0.5em" space-s: "1.0em" space-m: "1.5em" space-l: "2.0em" space-xl: "2.5em"

13robin37 avatar Dec 25 '21 15:12 13robin37

Maybe this issue can be addressed together with @sildehoop 's suggestion to make our internal templates more modular to be able to use them more versatile? https://github.com/UI-Lovelace-Minimalist/UI/discussions/105

This just came to my mind... But one thing at a time. We move slowly and steadily ;-) Merry Christmas to all of you

CM000n avatar Dec 25 '21 18:12 CM000n

A combo of variables and predefined classes would be the most versatile option if someone knows a way to apply classes to specific cards with card-mod. Haven't looked that much into it yet.

Merry Christmas and happy holidays btw! 😄

13robin37 avatar Dec 25 '21 18:12 13robin37

I thought about something like this to design the cards and think about the margins and sizes Schermafbeelding 2021-12-27 om 15 05 28

sildehoop avatar Dec 27 '21 14:12 sildehoop

Schermafbeelding 2021-12-27 om 16 50 24

sildehoop avatar Dec 27 '21 15:12 sildehoop