Make movie duration component dynamic
Updated MovieDurationComponent to accept a 'duration' input and display it dynamically. Adjusted usage in MoviePosterComponent to pass the duration value, improving reusability and flexibility.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
<span class="flex items-center text-black text-sm rounded-sm px-2 py-1.5">
|
<span class="flex items-center text-black text-sm rounded-sm px-2 py-1.5">
|
||||||
<mat-icon class="mr-1" style="font-size: 20px; width: 20px; height: 20px;" fontIcon="schedule"></mat-icon>
|
<mat-icon class="mr-1" style="font-size: 20px; width: 20px; height: 20px;" fontIcon="schedule"></mat-icon>
|
||||||
181 Min.
|
{{ getDurationText() }}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import { Component } from '@angular/core';
|
import { Component, Input } from '@angular/core';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-movie-duration',
|
selector: 'app-movie-duration',
|
||||||
@@ -7,5 +7,9 @@ import { Component } from '@angular/core';
|
|||||||
styleUrl: './movie-duration.component.css'
|
styleUrl: './movie-duration.component.css'
|
||||||
})
|
})
|
||||||
export class MovieDurationComponent {
|
export class MovieDurationComponent {
|
||||||
|
@Input() duration: number = 0;
|
||||||
|
|
||||||
|
getDurationText(): string {
|
||||||
|
return `${this.duration} Min.`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="flex gap-1 justify-between">
|
<div class="flex gap-1 justify-between">
|
||||||
<app-movie-rating [rating]="12"></app-movie-rating>
|
<app-movie-rating [rating]="12"></app-movie-rating>
|
||||||
<app-movie-duration></app-movie-duration>
|
<app-movie-duration [duration]="181"></app-movie-duration>
|
||||||
<app-movie-category></app-movie-category>
|
<app-movie-category></app-movie-category>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user