-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: card height in grid #1199
Open
akloeckner
wants to merge
7
commits into
kalkih:dev
Choose a base branch
from
akloeckner:fix/grid
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
fix: card height in grid #1199
Changes from 1 commit
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
f96100b
fix: card height in grid
akloeckner 3848307
simple fix for linestroke preserving aspect ratio
akloeckner 6753019
Alternate points rendering
selvalt7 3aabe59
Update style.js
ildar170975 6a56bf8
fix: graph clips out of bottom in small cards
akloeckner 6d74e07
doc: height disregarded in sections view
akloeckner 531864b
doc: improve grid description
akloeckner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check these examples:
![image](https://private-user-images.githubusercontent.com/71872483/402398557-15b482e9-dfba-4908-9a27-b9bd3f8ba0b1.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDI5MzAsIm5iZiI6MTczOTA0MjYzMCwicGF0aCI6Ii83MTg3MjQ4My80MDIzOTg1NTctMTViNDgyZTktZGZiYS00OTA4LTlhMjctYjliZDNmOGJhMGIxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNTAyMDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjUwMjA4VDE5MjM1MFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTc3OTZmMDIyYWY5YTAyNjBmMjcxY2I5YTgzNWZhNDhjZmEzZjFjZTJjNzc0OGRhMjA4NTFhODZjN2RkNmNlYTgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0In0.7kqzpJ-8nZ3wRy7SVGqEQxbkG_QgUS7oYRWS1eexR0s)
1st card - default
2nd - added
height: 100%
for:host
3rd - my PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the 100% on host were not enough. But maybe the first 100% needs to go where you put it in your PR... I'll check this. This is what a horizontal stack looks like with a scaled graph:
![image](https://private-user-images.githubusercontent.com/7125061/402399237-74295e64-9f53-4647-a851-f121f76f2e75.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwNDI5MzAsIm5iZiI6MTczOTA0MjYzMCwicGF0aCI6Ii83MTI1MDYxLzQwMjM5OTIzNy03NDI5NWU2NC05ZjUzLTQ2NDctYTg1MS1mMTIxZjc2ZjJlNzUucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI1MDIwOCUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNTAyMDhUMTkyMzUwWiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9OTExMGFjYzg4NjllMDhhNWY5NWUzNjc1YjhhYWNjZTdlMmZhNzg5ZDkxYjQyYjE4NDk1ZmNkZDA2YjI0N2EzMyZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QifQ.vtkLbm6mpDSWQGDjnbNFV3WwT9uCwh8j9nDOHYlCTlw)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks nice imho. Better than a tiny one. I will continue a review soon.
Also, we should check how a
height
option affects...There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI: by default any card inside horiz stack gets
display: block
; insidegrid
-display: inline
(automatically) - unless it is changed by a card's creator.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The height option sets the graph height in masonry. But if the height is already fixed by the view (grid, sections, horizontal stack), then the height option only affects the squishing of the stroke.
Wherever we continue with this, we should have selvalt in the loop. They had some idea to counter the squishing and started the discussion on this feature. I am afraid, I diluted the discussion a bit now...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so we seem to agree on this. I also checked the latest changes in #1139. I like the looks of the graph very much. Very neat fix for the line and point styles, @selvalt7! I also saw, you picked up the latest changes from #1155.
I therefore cherry-picked your points rendering and fixed up some remnant styles on the go. I also cherry-picked @ildar170975's latest change to the height of
:host
vs.ha-card
.So, I think, we now have a minimal set of changes required to properly support sections view. And it will be attributed to all of us. ;-)
Could you please test this PR and see, if we're missing any edge cases? I did some testing and all seems to work fine, but you had a deeper dive into these issues than I had...
I suggest then, we finish this PR here and then go on to discuss the other functionality in #1139 and possibly add it step by step. OK?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have found one edge case, with sections, when graph clips outside the card with this config:
I came up with an idea to set
min-height: 0
in this selector but also it could be done with size limiting in #1139.Other than that, it seems fine to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm. I played around a bit and there are lots of possibilities, how a user could make the card too small to fit everything in. If we make the card small enough, even the state will clip out of the bottom.
I think, this cannot and should not really be avoided automatically in the general case. At least YAML power users might have legitimate reasons to do this. Then, they'll have to live with the card being cut off. Even this might make sense for some:
However, the case you outlined should be fixed, because there is actually sufficient space available. The graph simply clips out of bound, because it has a default
height
set to 100px. And that is too tall. We should not change the default height, I think, because it would affect most of the users. We should not change it in section view only either, because this is only possible after initialization. So, I guess the CSS approach should be the way to go. 👍I'll tried it and it works nicely!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably we should allow to set a height manually - but it should be limited: not more than a possible value.
Assume someone need to have a SMALLER graph? (Like for adding additional elements above a graph with card-mod)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I was tempted to move this discussion into the main thread, but I realized, we're discussing here how advanced users might use the card. So, I'll keep it separate, in order for us to be able to close the discussion, once we're agreed.)
That would mean, the documented behaviour would be:
height
setting divided by 500, times the actual graph width. (Which is bit of legacy stupidity already.)height
setting well above the imaginable available space.While I think, that should be possible by setting a flex option which doesn't allow growing (but only shrinking)... I think, this is quite un-intuitive... A "normal" (as opposed to "advanced") user would expect the graph to just look nice without setting an arbitrary but high enough
height
. Wouldn't they?I don't think we should design the card to be as hackable as possible. At least not, if it impairs the "normal" user's experience. I think, if people have such specific needs for modifications, they will find a way, regardless of what we do... For example, they could simply override the flex setting themselves.