Added support for "large" sized cards

This commit is contained in:
Isaac Abadi
2020-08-22 00:47:18 -04:00
parent 2e4ef3b224
commit dc6dd5f5a2
5 changed files with 28 additions and 7 deletions

View File

@@ -17,7 +17,7 @@
</div> </div>
</div> </div>
<div class="col-12 order-1 col-sm-4 order-sm-2 d-flex justify-content-center"> <div class="col-12 order-1 col-sm-4 order-sm-2 d-flex justify-content-center">
<h4 style="text-align: center">My videos</h4> <h4 style="text-align: center; position: relative; top: 12px;">My videos</h4>
</div> </div>
<div class="col-12 order-3 col-sm-4 order-sm-3 d-flex justify-content-center"> <div class="col-12 order-3 col-sm-4 order-sm-3 d-flex justify-content-center">
<mat-form-field [ngClass]="searchIsFocused ? 'search-bar-focused' : 'search-bar-unfocused'" class="search-bar" color="accent"> <mat-form-field [ngClass]="searchIsFocused ? 'search-bar-focused' : 'search-bar-unfocused'" class="search-bar" color="accent">
@@ -30,7 +30,7 @@
<div> <div>
<div class="container"> <div class="container">
<div class="row justify-content-center"> <div class="row justify-content-center">
<div *ngFor="let file of filtered_files; let i = index" [ngClass]="[ postsService.card_size === 'small' ? 'col-2 mb-2 mt-2 file-col' : '', postsService.card_size === 'medium' ? 'col-6 col-lg-4 mb-2 mt-2 file-col' : '' ]"> <div *ngFor="let file of filtered_files; let i = index" class="mb-2 mt-2" [ngClass]="[ postsService.card_size === 'small' ? 'col-2 small-col' : '', postsService.card_size === 'medium' ? 'col-6 col-lg-4 medium-col' : '', postsService.card_size === 'large' ? 'col-12 large-col' : '' ]">
<app-unified-file-card [index]="i" [card_size]="postsService.card_size" (goToFile)="goToFile($event)" (goToSubscription)="goToSubscription($event)" [file_obj]="file" [use_youtubedl_archive]="postsService.config['Downloader']['use_youtubedl_archive']" (deleteFile)="deleteFile($event)"></app-unified-file-card> <app-unified-file-card [index]="i" [card_size]="postsService.card_size" (goToFile)="goToFile($event)" (goToSubscription)="goToSubscription($event)" [file_obj]="file" [use_youtubedl_archive]="postsService.config['Downloader']['use_youtubedl_archive']" (deleteFile)="deleteFile($event)"></app-unified-file-card>
</div> </div>
</div> </div>

View File

@@ -1,4 +1,12 @@
.file-col { .large-col {
max-width: 320px;
}
.medium-col {
max-width: 240px;
}
.small-col {
max-width: 240px; max-width: 240px;
} }

View File

@@ -21,11 +21,11 @@
<button (click)="emitDeleteFile()" mat-menu-item><mat-icon>delete_forever</mat-icon><ng-container i18n="Delete playlist">Delete</ng-container></button> <button (click)="emitDeleteFile()" mat-menu-item><mat-icon>delete_forever</mat-icon><ng-container i18n="Delete playlist">Delete</ng-container></button>
</ng-container> </ng-container>
</mat-menu> </mat-menu>
<mat-card [matTooltip]="null" (click)="navigateToFile()" matRipple class="file-mat-card" [ngClass]="{'small-mat-card': card_size === 'small', 'file-mat-card': card_size === 'medium', 'mat-elevation-z4': !elevated, 'mat-elevation-z8': elevated}"> <mat-card [matTooltip]="null" (click)="navigateToFile()" matRipple class="file-mat-card" [ngClass]="{'small-mat-card': card_size === 'small', 'file-mat-card': card_size === 'medium', 'large-mat-card': card_size === 'large', 'mat-elevation-z4': !elevated, 'mat-elevation-z8': elevated}">
<div style="padding:5px"> <div style="padding:5px">
<div *ngIf="file_obj.thumbnailURL" class="img-div"> <div *ngIf="file_obj.thumbnailURL" class="img-div">
<div style="position: relative"> <div style="position: relative">
<img [ngClass]="{'image-small': card_size === 'small', 'image': card_size === 'medium'}" [src]="file_obj.thumbnailURL" alt="Thumbnail"> <img [ngClass]="{'image-small': card_size === 'small', 'image': card_size === 'medium', 'image-large': card_size === 'large'}" [src]="file_obj.thumbnailURL" alt="Thumbnail">
<div class="duration-time"> <div class="duration-time">
{{file_length}} {{file_length}}
</div> </div>
@@ -33,7 +33,7 @@
</div> </div>
<span [ngClass]="{'max-two-lines': card_size !== 'small', 'max-one-line': card_size === 'small' }"><strong>{{!is_playlist ? file_obj.title : file_obj.name}}</strong></span> <span [ngClass]="{'max-two-lines': card_size !== 'small', 'max-one-line': card_size === 'small' }">{{card_size === 'large' && file_obj.uploader ? file_obj.uploader + ' - ' : ''}}<strong>{{!is_playlist ? file_obj.title : file_obj.name}}</strong></span>
</div> </div>
</mat-card> </mat-card>
</div> </div>

View File

@@ -1,3 +1,10 @@
.large-mat-card {
width: 300px;
height: 250px;
padding: 0px;
cursor: pointer;
}
.file-mat-card { .file-mat-card {
width: 200px; width: 200px;
height: 200px; height: 200px;
@@ -26,6 +33,12 @@
justify-content: center; justify-content: center;
} }
.image-large {
width: 300px;
height: 167.5px;
object-fit: cover;
}
.image { .image {
width: 200px; width: 200px;
height: 112.5px; height: 112.5px;

View File

@@ -40,7 +40,7 @@
<br/> <br/>
<mat-form-field placeholder="Card size"> <mat-form-field placeholder="Card size">
<mat-select [(ngModel)]="card_size" (selectionChange)="cardSizeOptionChanged($event.value)"> <mat-select [(ngModel)]="card_size" (selectionChange)="cardSizeOptionChanged($event.value)">
<mat-option value="large" [disabled]="true"> <mat-option value="large">
Large Large
</mat-option> </mat-option>
<mat-option value="medium"> <mat-option value="medium">