Favorites (#4)
* Added favorites page * Refactor table to a reusable component Reviewed-on: #4 Co-authored-by: Berack96 <giacomobertolazzi7@gmail.com> Co-committed-by: Berack96 <giacomobertolazzi7@gmail.com>
This commit was merged in pull request #4.
This commit is contained in:
35
Components/Layout/MovieTable.razor
Normal file
35
Components/Layout/MovieTable.razor
Normal file
@@ -0,0 +1,35 @@
|
||||
<table class="table table-striped" id="moviesTable">
|
||||
<thead class="table-primary">
|
||||
<tr>
|
||||
<th></th>
|
||||
<th style="width: 100%;">Title</th>
|
||||
<th>Year</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if (Movies?.Search != null)
|
||||
{
|
||||
@foreach (var movie in Movies.Search)
|
||||
{
|
||||
<tr>
|
||||
<td><button class="btn btn-secondary" @onclick="() => OnMovieSelected(movie.IdIMDB)">Details</button></td>
|
||||
<td>@movie.Title</td>
|
||||
<td>@movie.Year</td>
|
||||
</tr>
|
||||
}
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@inject NavigationManager NavigationManager
|
||||
|
||||
@code {
|
||||
|
||||
[Parameter]
|
||||
public MovieSearch? Movies { get; set; }
|
||||
|
||||
private async Task OnMovieSelected(string imdbID)
|
||||
{
|
||||
NavigationManager.NavigateTo($"/movie/{imdbID}");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user