Skip to content
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

Improve behavior of image columns #1637

Merged
merged 3 commits into from
Feb 8, 2023
Merged

Improve behavior of image columns #1637

merged 3 commits into from
Feb 8, 2023

Conversation

Janpot
Copy link
Member

@Janpot Janpot commented Feb 7, 2023

  • Don't show anything if there is no value
  • Show a thumbnail with a popover, avoid auto row height
Screen.Recording.2023-02-07.at.12.01.03.mov

@oliviertassinari oliviertassinari requested a deployment to images-columns - toolpad-db PR #1637 February 7, 2023 11:05 — with Render Abandoned
@Janpot Janpot added the core Infrastructure work going on behind the scenes label Feb 7, 2023
@Janpot Janpot marked this pull request as ready for review February 7, 2023 12:37
@apedroferreira
Copy link
Member

Is there a way to have more control over the image size, or should there?
Anyway this solution works for me in that sense as not sure what the best approach would be, could depend on different use cases...

Found a bug though, on the 2nd item the popover was looking really big to me and had a scroll bar:

Screen.Recording.2023-02-07.at.17.54.01.mov

Copy link
Member

@apedroferreira apedroferreira left a comment

Choose a reason for hiding this comment

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

Just the bug I found, code seems good!

@oliviertassinari oliviertassinari temporarily deployed to images-columns - toolpad PR #1637 February 8, 2023 08:16 — with Render Destroyed
@oliviertassinari oliviertassinari temporarily deployed to images-columns - toolpad PR #1637 February 8, 2023 08:25 — with Render Destroyed
@Janpot
Copy link
Member Author

Janpot commented Feb 8, 2023

Is there a way to have more control over the image size, or should there?

You can always create a custom component. I believe this is a more sensible default as it just behaves the way text behaves, i.e. just take the available space. The previous solution uses getRowHeight: () => 'auto', which had the side effect that it resized the rows on other columns as well, which is not the intended behavior.

Found a bug though, on the 2nd item the popover was looking really big to me and had a scroll bar:

I limited the size of the popover image. I also made sure cell alignment still works

Copy link
Member

@apedroferreira apedroferreira left a comment

Choose a reason for hiding this comment

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

You can always create a custom component. I believe this is a more sensible default as it just behaves the way text behaves, i.e. just take the available space.

Sounds good, that's better now that we have custom component columns.
This looks good now!

@Janpot Janpot merged commit 119c4c7 into master Feb 8, 2023
@Janpot Janpot deleted the images-columns branch February 8, 2023 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Infrastructure work going on behind the scenes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants