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): object fit to properly handle non-squared images #4298

Merged
merged 2 commits into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/ui/src/components/va-avatar/VaAvatar.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ export const Square = () => ({
`,
})

/** Must be centered image */
export const NonSquareAspectRation = () => ({
components: { VaAvatar },
template: `
<VaAvatar src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_light_color_272x92dp.png" />
`,
})

export const Loading = () => ({
components: { VaAvatar },
template: '<VaAvatar loading/>',
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/va-avatar/VaAvatar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ defineExpose({
img,
svg {
object-fit: var(--va-avatar-object-fit);
border-radius: inherit;
display: inline-flex;
height: inherit;
Expand Down
1 change: 1 addition & 0 deletions packages/ui/src/components/va-avatar/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
--va-avatar-position: relative;
--va-avatar-line-height: normal;
--va-avatar-border-radius: 50%;
--va-avatar-object-fit: cover;
}
Loading