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

fix(Avatar): Remove incorrect aspect ratio for image #1824

Merged
merged 2 commits into from
Jan 22, 2025

Conversation

VincentSmedinga
Copy link
Contributor

Describe the pull request

Thank you for contributing to the project!
Please use this template to help us handle your PR smoothly.

What

Restores the correct display of an Image in an Avatar.

Why

The new default aspect ratio for the Image component (introduced in #1593) forces it to 16:9.

How

I’m resetting the aspect ratio for an .ams-image in an .ams-avatar. We don’t know its dimensions, and the user can’t easily provide them. We already ensured to show the center of the image; I’ve made that explicit in the docs.

I decided against using a clean HTML img element because we still want to apply the other base styles of our image component.

Checklist

Before submitting your pull request, please ensure you have done the following. Check each checkmark if you have done so or if it wasn't necessary:

  • Add or update unit tests
  • Add or update documentation
  • Add or update stories
  • Add or update exports in index.* files
  • Start the PR title with a Conventional Commit prefix, as explained here.

Additional notes

None.

@VincentSmedinga VincentSmedinga requested a review from a team as a code owner January 20, 2025 22:21
@VincentSmedinga VincentSmedinga enabled auto-merge (squash) January 20, 2025 22:22
@VincentSmedinga VincentSmedinga changed the title fix(Avatar): Override aspect ratio for Image in Avatar fix(Avatar): Override aspect ratio for image Jan 20, 2025
We don’t need the base styles of our Image component. All the aspect ratio stuff in there is irrelevant, because we reset it here. The phantom whitespace thing is not an issue, because this image is a child of a wrapper with an aspect ratio. And the alt text of this image is an empty string.
@github-actions github-actions bot temporarily deployed to demo-avatar-image-aspect-ratio January 22, 2025 10:57 Destroyed
@VincentSmedinga VincentSmedinga changed the title fix(Avatar): Override aspect ratio for image fix(Avatar): Remove incorrect aspect ratio for image Jan 22, 2025
@VincentSmedinga VincentSmedinga merged commit 3743820 into develop Jan 22, 2025
7 checks passed
@VincentSmedinga VincentSmedinga deleted the fix/avatar-image-aspect-ratio branch January 22, 2025 12:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants