Po kliknuti na celou kartu se otevre detail produtu
This commit is contained in:
@@ -1,6 +1,13 @@
|
|||||||
@using Web_Jarmark.Data.Models
|
@using Web_Jarmark.Data.Models
|
||||||
|
@using Microsoft.AspNetCore.Components.Web
|
||||||
|
@inject NavigationManager NavigationManager
|
||||||
|
|
||||||
|
<article class="market-card"
|
||||||
|
role="link"
|
||||||
|
tabindex="0"
|
||||||
|
@onclick="OpenProductDetail"
|
||||||
|
@onkeydown="HandleCardKeyDown">
|
||||||
|
|
||||||
<article class="market-card">
|
|
||||||
<div class="market-product-picture">
|
<div class="market-product-picture">
|
||||||
@if (!string.IsNullOrWhiteSpace(Product.ImageUrl) && !imageFailed)
|
@if (!string.IsNullOrWhiteSpace(Product.ImageUrl) && !imageFailed)
|
||||||
{
|
{
|
||||||
@@ -23,9 +30,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="market-card-content">
|
<div class="market-card-content">
|
||||||
<a href="@($"/produkt/{Product.Id}")" class="product-detail-link">
|
<h3>@Product.Name</h3>
|
||||||
<h3>@Product.Name</h3>
|
|
||||||
</a>
|
|
||||||
|
|
||||||
@if (!string.IsNullOrWhiteSpace(Product.Description))
|
@if (!string.IsNullOrWhiteSpace(Product.Description))
|
||||||
{
|
{
|
||||||
@@ -56,7 +61,8 @@
|
|||||||
<button type="button"
|
<button type="button"
|
||||||
class="product-cart-button"
|
class="product-cart-button"
|
||||||
disabled="@(Product.StockQuantity <= 0)"
|
disabled="@(Product.StockQuantity <= 0)"
|
||||||
@onclick="AddToCart">
|
@onclick="AddToCart"
|
||||||
|
@onclick:stopPropagation="true">
|
||||||
🛒 Do košíku
|
🛒 Do košíku
|
||||||
</button>
|
</button>
|
||||||
}
|
}
|
||||||
@@ -77,6 +83,19 @@
|
|||||||
imageFailed = false;
|
imageFailed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OpenProductDetail()
|
||||||
|
{
|
||||||
|
NavigationManager.NavigateTo($"/produkt/{Product.Id}");
|
||||||
|
}
|
||||||
|
|
||||||
|
private void HandleCardKeyDown(KeyboardEventArgs e)
|
||||||
|
{
|
||||||
|
if (e.Key == "Enter" || e.Key == " ")
|
||||||
|
{
|
||||||
|
OpenProductDetail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void HandleImageError()
|
private void HandleImageError()
|
||||||
{
|
{
|
||||||
imageFailed = true;
|
imageFailed = true;
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user