Skip to content

Commit

Permalink
Fix incorrect rounding for user avatars in links
Browse files Browse the repository at this point in the history
  • Loading branch information
jvyden committed Aug 28, 2024
1 parent 17ebfe9 commit 853b2b7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/app/components/ui/photos/user-avatar.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import { NgClass, NgOptimizedImage, NgStyle } from "@angular/common";
],
template: `
@if (this.user) {
<img [ngSrc]=this.user.iconHash [width]=size [height]=size class="inline rounded-md h-auto aspect-square object-cover" alt=""
(error)="err($event.target)" [ngStyle]="{'min-height': size + 'px', 'min-width': size + 'px'}" loading="lazy">
<img [ngSrc]=this.user.iconHash [width]=size [height]=size class="inline h-auto aspect-square object-cover" alt=""
(error)="err($event.target)" loading="lazy"
[ngStyle]="{'min-height': size + 'px', 'min-width': size + 'px'}"
[ngClass]="borderRule">
}
`
})
Expand All @@ -22,6 +24,7 @@ export class UserAvatarComponent {
error: boolean = false;

@Input() size: number = 19;
@Input() borderRule: string = "rounded";

err(img: EventTarget | null): void {
if(this.error) return;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/ui/text/links/user-link.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {ClientService} from "../../../../api/client.service";
template: `
@if(user) {
<app-user-router-link class="ml-1 inline" [user]=user>
<app-user-avatar [user]=user class="inline mr-1"></app-user-avatar>
<app-user-avatar [user]=user class="inline mr-1" borderRule="rounded-[3px]"></app-user-avatar>
<span>{{ user.username }}</span>
</app-user-router-link>
} @else {
Expand Down
3 changes: 2 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ module.exports = {
},
borderRadius: {
'none': '0',
DEFAULT: '11px',
DEFAULT: '0.6875rem',
// DEFAULT: '11px',
'md': '0.375rem',
'lg': '0.5rem',
'full': '9999px',
Expand Down

0 comments on commit 853b2b7

Please sign in to comment.