movie detail

This commit is contained in:
2026-01-20 13:46:12 +01:00
parent 54814cbcce
commit 86b91263a8
2 changed files with 35 additions and 11 deletions

View File

@@ -1,11 +0,0 @@
@page "/movie/{id}"
<PageTitle>Movie Details</PageTitle>
<h1>TODO</h1>
<p>Movie ID: @id</p>
@code {
[Parameter]
public string id { get; set; }
}

View File

@@ -0,0 +1,35 @@
@page "/movie/{id}"
<PageTitle>Movie Details</PageTitle>
<div style="display: grid; grid-template-columns: 1fr 2fr; grid-template-rows: auto auto; gap: 20px; max-width: 800px; margin-right: auto;">
@if (movie is not null)
{
<h1>@movie.Title</h1>
<div></div>
<img src="@movie.Poster" alt="@movie.Title Poster" />
<div class="details">
<p>@movie.Runtime</p>
<p>@movie.Plot</p>
<button>Favorite</button>
</div>
}
else
{
<p>Loading movie details...</p>
}
</div>
@inject OmdbService OmdbService
@code {
[Parameter]
public required string id { get; set; }
private Movie? movie;
protected override async Task OnInitializedAsync()
{
movie = await OmdbService.FetchMovieDetail(id);
}
}