Skip to content

Commit

Permalink
Fix search channel avatar size
Browse files Browse the repository at this point in the history
  • Loading branch information
Chocobozzz committed Feb 27, 2024
1 parent bb21e0b commit dee2e66
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
2 changes: 1 addition & 1 deletion client/src/app/+search/search.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div *ngIf="isVideoChannel(result)" class="entry video-channel">

<my-actor-avatar
[actor]="result" actorType="channel"
[actor]="result" actorType="channel" responseSize="true"
[internalHref]="getInternalChannelUrl(result)" [href]="getExternalChannelUrl(result)" size="120"
></my-actor-avatar>

Expand Down
11 changes: 7 additions & 4 deletions client/src/app/+search/search.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,13 @@
@use '_mixins' as *;

@mixin build-channel-img-size ($video-img-width) {
$image-size: min(130px, $video-img-width);
$image-size: min(120px, $video-img-width);
$margin-size: math.div(($video-img-width - $image-size), 2); // So we have the same width as the video miniature

@include actor-avatar-size($image-size);
width: $image-size;
height: $image-size;
min-height: $image-size;
min-width: $image-size;

margin: 0 calc($margin-size + 1rem) 0 $margin-size;
}
Expand Down Expand Up @@ -59,7 +62,7 @@

.video-channel {
my-actor-avatar {
@include margin-right(1rem);
@include build-channel-img-size($video-thumbnail-width);
}
}

Expand Down Expand Up @@ -88,7 +91,7 @@
color: pvar(--greyForegroundColor);
}

// Use the same breakpoints than in video-miniature
// Use the same breakpoints as in video-miniature
@include on-small-main-col {
.video-channel {
display: grid;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Component, ElementRef, Input, OnChanges, OnInit, ViewChild, numberAttribute } from '@angular/core'
import { Component, ElementRef, Input, OnChanges, OnInit, ViewChild, booleanAttribute, numberAttribute } from '@angular/core'
import { VideoChannel } from '../shared-main'
import { Account } from '../shared-main/account/account.model'
import { objectKeysTyped } from '@peertube/peertube-core-utils'
Expand All @@ -22,6 +22,7 @@ export class ActorAvatarComponent implements OnInit, OnChanges {
@Input() previewImage: string

@Input({ transform: numberAttribute }) size = 120
@Input({ transform: booleanAttribute }) responseSize = false

// Use an external link
@Input() href: string
Expand Down Expand Up @@ -68,7 +69,7 @@ export class ActorAvatarComponent implements OnInit, OnChanges {

this.classes = [ 'avatar' ]

if (this.size) {
if (this.size && !this.responseSize) {
avatarSize = `${this.size}px`

if (this.size <= 18) {
Expand Down

0 comments on commit dee2e66

Please sign in to comment.