Skip to content
Snippets Groups Projects
Commit c3b56bd1 authored by Berna Tülek's avatar Berna Tülek
Browse files

Add slide animation for new comments

parent c4b074f0
No related merge requests found
<mat-card class="card-container"> <mat-card class="card-container" [@slide]>
<div fxLayout="column"> <div fxLayout="column">
<div fxLayout="row"> <div fxLayout="row">
<span class="fill-remaining-space"></span> <span class="fill-remaining-space"></span>
<button mat-icon-button *ngIf="comment.correct || !isStudent" [disabled]="isStudent" (click)="setCorrect(comment)" [matTooltip]="comment.correct ? 'Unmark as correct' : 'Mark as correct'"> <button mat-icon-button *ngIf="comment.correct || !isStudent" [disabled]="isStudent" (click)="setCorrect(comment)"
[matTooltip]="comment.correct ? 'Unmark as correct' : 'Mark as correct'">
<mat-icon [ngClass]="{true : 'correct-icon', false: 'incorrect-icon'}[comment.correct]">check_circle</mat-icon> <mat-icon [ngClass]="{true : 'correct-icon', false: 'incorrect-icon'}[comment.correct]">check_circle</mat-icon>
</button> </button>
<button mat-icon-button *ngIf="comment.favorite || !isStudent" [disabled]="isStudent" (click)="setFavorite(comment)" [matTooltip]="comment.favorite ? 'Mark as not favorite' : 'Mark as favorite'"> <button mat-icon-button *ngIf="comment.favorite || !isStudent" [disabled]="isStudent"
(click)="setFavorite(comment)" [matTooltip]="comment.favorite ? 'Mark as not favorite' : 'Mark as favorite'">
<mat-icon [ngClass]="{true: 'favorite-icon', false: 'not-favorite-icon'}[comment.favorite]">star</mat-icon> <mat-icon [ngClass]="{true: 'favorite-icon', false: 'not-favorite-icon'}[comment.favorite]">star</mat-icon>
</button> </button>
<button mat-icon-button [disabled]="isStudent" (click)="setRead(comment)" [matTooltip]="comment.read ? 'Mark as unread' : 'Mark as read'"> <button mat-icon-button [disabled]="isStudent" (click)="setRead(comment)"
[matTooltip]="comment.read ? 'Mark as unread' : 'Mark as read'">
<mat-icon [ngClass]="{true: 'read-icon', false: 'unread-icon'}[comment.read]">visibility</mat-icon> <mat-icon [ngClass]="{true: 'read-icon', false: 'unread-icon'}[comment.read]">visibility</mat-icon>
</button> </button>
</div> </div>
...@@ -26,4 +29,4 @@ ...@@ -26,4 +29,4 @@
</div> </div>
</div> </div>
</div> </div>
</mat-card> </mat-card>
\ No newline at end of file
...@@ -10,12 +10,20 @@ import { LanguageService } from '../../../services/util/language.service'; ...@@ -10,12 +10,20 @@ import { LanguageService } from '../../../services/util/language.service';
import { WsCommentServiceService } from '../../../services/websockets/ws-comment-service.service'; import { WsCommentServiceService } from '../../../services/websockets/ws-comment-service.service';
import { PresentCommentComponent } from '../_dialogs/present-comment/present-comment.component'; import { PresentCommentComponent } from '../_dialogs/present-comment/present-comment.component';
import { MatDialog } from '@angular/material'; import { MatDialog } from '@angular/material';
import { trigger, transition, style, animate, state } from '@angular/animations';
@Component({ @Component({
selector: 'app-comment', selector: 'app-comment',
templateUrl: './comment.component.html', templateUrl: './comment.component.html',
styleUrls: ['./comment.component.scss'] styleUrls: ['./comment.component.scss'],
animations: [
trigger('slide', [
state('void', style({opacity: 0, transform: 'translateY(-10px)'})),
transition('void <=> *', animate(700)),
]),
]
}) })
export class CommentComponent implements OnInit { export class CommentComponent implements OnInit {
@Input() comment: Comment; @Input() comment: Comment;
isStudent = false; isStudent = false;
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment