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

KImg: Add scaling and placeholder logic #370

Closed
7 tasks
MisRob opened this issue Sep 22, 2022 · 5 comments
Closed
7 tasks

KImg: Add scaling and placeholder logic #370

MisRob opened this issue Sep 22, 2022 · 5 comments
Assignees
Labels
category: library Shared code library

Comments

@MisRob
Copy link
Member

MisRob commented Sep 22, 2022

Summary

Implement placeholder and scaling logic for KImg.

This includes the following props:

  • aspectRatio
  • scaleType
  • placeholderColor
  • borderRadius

and the placeholder slot.

See the epic issue for more details about those props and the slot, as well as for the description and illustration of scale types to be implemented.

Epic

Acceptance criteria

  • All props and the slot mentioned above are functioning according to how they are defined in the epic issue
  • All 'centerInside', 'contain', and 'fitXY' scale types are implemented
  • KImg throws a warning when aspectRatio prop value is provided in an unsupported format
  • KImg throws a warning when unsupported scaleType prop value is provided
  • The placeholder area respects sizing (could be set for example with width, height, maxWidth props, etc.), aspectRatio, and borderRadius settings the same way an image would if it were available
  • The placeholder slot's content is centered and shows behind a loading image (progressive UI), when an image could not be loaded, or when there is no or empty image src provided. It is rendered on top of the container filled with the placeholderColor.
  • Documentation is updated with all new features. Contains guidance and examples whenever relevant.

Linked issues

@akolson akolson mentioned this issue Sep 22, 2022
5 tasks
@MisRob MisRob changed the title [TBD] KImg: Add scaling and placeholder logic KImg: Add scaling and placeholder logic Sep 23, 2022
@MisRob
Copy link
Member Author

MisRob commented Sep 23, 2022

Regarding aspect ratio, we already have it implemented in Kolibri's thumbnail for 16:9, inspired by this technique: https://www.sitepoint.com/maintain-image-aspect-ratios-responsive-web-design/. This component also contains logic for placeholders that could be re-used. My recommendation would be to try to build on top of that and generalize it for any aspect ratio.

@MisRob MisRob self-assigned this Jul 25, 2023
@MisRob MisRob added this to the KDS Priority Triage milestone Sep 19, 2023
@BabyElias
Copy link
Contributor

Hello @MisRob ! Can I work on this issue?

@MisRob
Copy link
Member Author

MisRob commented Dec 15, 2023

Hi @BabyElias, thank you. KImg work is already in progress so this wouldn't be suitable.

@BabyElias
Copy link
Contributor

Okay, thanks!

@MisRob MisRob mentioned this issue Jan 31, 2024
9 tasks
@MisRob
Copy link
Member Author

MisRob commented Feb 27, 2024

Closed by #538

@MisRob MisRob closed this as completed Feb 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: library Shared code library
Projects
None yet
Development

No branches or pull requests

2 participants