Make movie category dynamic

Refactored MovieCategoryComponent to accept a 'category' input and display it dynamically. Updated usage in MoviePosterComponent to pass the category value, improving flexibility and reusability.
This commit is contained in:
2025-10-29 10:26:29 +01:00
parent eaab2bef4e
commit b304185e21
3 changed files with 9 additions and 3 deletions

View File

@@ -1 +1,3 @@
<span class="flex rounded-sm text-black text-sm px-2 py-1.5">Aktion</span>
<span class="flex rounded-sm text-black text-sm px-2 py-1.5">
{{ getCategoryText() }}
</span>

View File

@@ -1,4 +1,4 @@
import { Component } from '@angular/core';
import { Component, Input } from '@angular/core';
@Component({
selector: 'app-movie-category',
@@ -7,5 +7,9 @@ import { Component } from '@angular/core';
styleUrl: './movie-category.component.css'
})
export class MovieCategoryComponent {
@Input() category: string = '-';
getCategoryText(): string {
return this.category;
}
}

View File

@@ -4,5 +4,5 @@
<div class="flex gap-1 justify-between">
<app-movie-rating [rating]="12"></app-movie-rating>
<app-movie-duration [duration]="181"></app-movie-duration>
<app-movie-category></app-movie-category>
<app-movie-category [category]="'Action'"></app-movie-category>
</div>