Skip to content

Lovelace Cards: Update size calcs and add height fixes for horizontal stacks#7177

Merged
bramkragten merged 8 commits intodevfrom
card-sizes
Oct 15, 2020
Merged

Lovelace Cards: Update size calcs and add height fixes for horizontal stacks#7177
bramkragten merged 8 commits intodevfrom
card-sizes

Conversation

@zsarnett
Copy link
Copy Markdown
Contributor

@zsarnett zsarnett commented Oct 1, 2020

Breaking change

Yes. This will change the way Users layouts will display. BUT this is how this should have been done in the first place. We should compare 1 unit to 1 regular entity row. If the card goes into the next row size at all then it should be + 1 size. This will help Custom View better know the starting size of the cards

Proposed change

Update sizes of cards

Type of change

  • Code quality improvements to existing code or addition of tests

Additional information

This is part of my Drag and Drop PR but I am breaking this out since it is a breaking change.

@zsarnett zsarnett added the Breaking Change Needs Special Documentation to let users know about Change label Oct 1, 2020
@zsarnett
Copy link
Copy Markdown
Contributor Author

zsarnett commented Oct 1, 2020

Here are a few examples

Examples

image
image
image
image
image
image

@iantrich
Copy link
Copy Markdown
Member

iantrich commented Oct 1, 2020

@zsarnett how does this compare to now?

@zsarnett
Copy link
Copy Markdown
Contributor Author

zsarnett commented Oct 1, 2020

@iantrich This doesn't change the actual sizes of any card. It just reports them better

@zsarnett zsarnett marked this pull request as draft October 2, 2020 14:13
@zsarnett
Copy link
Copy Markdown
Contributor Author

zsarnett commented Oct 2, 2020

Want to retest the horizontal stack stuff before this is merged and maybe make a few adjustments for entity filter conditional cards etc (this is mostly code from my drag and drop PR, for the horizontal stack fixes)

@zsarnett
Copy link
Copy Markdown
Contributor Author

So I think we should make image/picture cards the height 100% of the card. Example:
image

This comes into play more for the Drag and drop. If I resize my picture card the image should fill the div

@zsarnett
Copy link
Copy Markdown
Contributor Author

image

@zsarnett zsarnett marked this pull request as ready for review October 10, 2020 22:34
@bramkragten
Copy link
Copy Markdown
Member

bramkragten commented Oct 12, 2020

We should not stretch the image right? Maybe we can add a option for contain/cover/stretch/center/repeat/whatever... But the default should be cover I think?

@zsarnett
Copy link
Copy Markdown
Contributor Author

zsarnett commented Oct 13, 2020

Its not a background image though its an image..

Without it being an image we don't really know what the height should be

@bramkragten
Copy link
Copy Markdown
Member

bramkragten commented Oct 13, 2020

Would work if you use the aspect ratio option... But yeah...

But stretching the image is a no-go for me, in the drag and drop maybe, as the users set the height themselves (and you could use a div with a background?)

@zsarnett
Copy link
Copy Markdown
Contributor Author

I will leave it out for now and determine what is needed in the Drag and drop PR

Comment on lines -270 to -272
:host {
display: block;
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't need display: block anymore? What is changed?

@bramkragten bramkragten merged commit c1dba46 into dev Oct 15, 2020
@bramkragten bramkragten deleted the card-sizes branch October 15, 2020 15:46
@ronaldtveen
Copy link
Copy Markdown

ronaldtveen commented Oct 15, 2020

Its not a background image though its an image..

Without it being an image we don't really know what the height should be

I was watching @zsarnett stream recording and in that you mentioned this ^^
Actually, there is a (well supported) way to cover or contain the img tag, not not just a background image. IE has no support (go figure) but all major browsers are perfectly fine with it.

https://developer.mozilla.org/en-US/docs/Web/CSS/object-fit

I have to agree with Bram about the stretching of images, that is a big no-no in any situation.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Breaking Change Needs Special Documentation to let users know about Change cla-signed

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants