upraveni kosiku aby to bylo hezci

This commit is contained in:
maja
2026-10-30 17:12:28 +01:00
parent 312192a6d6
commit 7e2d20d889
4 changed files with 369 additions and 34 deletions

View File

@@ -10,45 +10,113 @@
<PageTitle>Můj košík | Školní jarmark</PageTitle>
<main class="market-shell">
<h1>Můj košík</h1>
@if (isLoading)
{
<p>Načítám košík...</p>
}
else if (cartItems.Count == 0)
{
<div class="empty-cart">
<h2>Tvůj košík je prázdný</h2>
<p>Vyber si něco z našeho katalogu.</p>
<a href="/">Zpět do katalogu</a>
<main class="market-shell cart-page">
<div class="cart-header">
<div>
<span class="cart-eyebrow">ŠKOLNÍ JARMARK</span>
<h1>Můj košík</h1>
<p>Vše, co sis vybral, na jednom místě.</p>
</div>
<a href="/" class="cart-back-link">← Pokračovat v nákupu</a>
</div>
}
else
{
<div class="cart-items">
@foreach (var item in cartItems)
{
<article class="cart-item" @key="item.Id">
<div>
<h3>@item.Product.Name</h3>
<p>@item.Product.Price.ToString("N0") Kč / ks</p>
<p>Množství: @item.Quantity ks</p>
@if (isLoading)
{
<p>Načítám košík...</p>
}
else if (cartItems.Count == 0)
{
<div class="cart-empty">
<div class="cart-empty-icon">🛒</div>
<h2>Košík je zatím prázdný</h2>
<p>V katalogu na tebe čeká spousta zajímavých produktů.</p>
<a href="/" class="cart-primary-button">Prohlédnout katalog</a>
</div>
}
else
{
<div class="cart-layout">
<section class="cart-product-list">
<div class="cart-list-heading">
<h2>Vybrané produkty</h2>
<span>@cartItems.Count položek</span>
</div>
<strong>
@((item.Product.Price * item.Quantity).ToString("N0")) Kč
</strong>
</article>
}
</div>
@foreach (var item in cartItems)
{
<article class="cart-product" @key="item.Id">
<div class="cart-product-image">
@if (!string.IsNullOrWhiteSpace(item.Product.ImageUrl))
{
<img src="@item.Product.ImageUrl"
alt="@item.Product.Name" />
}
else
{
<span>🎁</span>
}
</div>
<div class="cart-total">
<h2>
Celkem: @totalPrice.ToString("N0") Kč
</h2>
</div>
}
<div class="cart-product-info">
<h3>@item.Product.Name</h3>
@if (item.Product.Category != null)
{
<span class="cart-category">
@item.Product.Category.Name
</span>
}
<p>@item.Product.Price.ToString("N0") Kč / ks</p>
</div>
<div class="cart-product-quantity">
<span>Množství</span>
<strong>@item.Quantity ks</strong>
</div>
<div class="cart-product-price">
<strong>
@((item.Product.Price * item.Quantity).ToString("N0")) Kč
</strong>
</div>
</article>
}
</section>
<aside class="cart-summary">
<h2>Souhrn objednávky</h2>
<div class="cart-summary-row">
<span>Počet kusů</span>
<strong>@cartItems.Sum(i => i.Quantity)</strong>
</div>
<div class="cart-summary-row">
<span>Počet produktů</span>
<strong>@cartItems.Count</strong>
</div>
<div class="cart-summary-divider"></div>
<div class="cart-summary-total">
<span>Celkem</span>
<strong>@totalPrice.ToString("N0") Kč</strong>
</div>
<button class="cart-primary-button" disabled>
Pokračovat k objednávce
</button>
<p class="cart-summary-note">
Objednávku dokončíš v dalším kroku.
</p>
</aside>
</div>
}
</main>
</main>
@code {

View File

@@ -2376,3 +2376,270 @@ textarea.wj-input {
height: 210px;
}
}
/* CART PAGE */
.cart-page {
padding-top: 40px;
padding-bottom: 70px;
}
.cart-header {
display: flex;
justify-content: space-between;
align-items: center;
gap: 20px;
margin-bottom: 35px;
}
.cart-eyebrow {
font-size: 12px;
font-weight: 700;
letter-spacing: 2px;
color: #888;
}
.cart-header h1 {
font-size: 36px;
font-weight: 800;
margin: 8px 0;
}
.cart-header p {
color: #777;
margin: 0;
}
.cart-back-link {
color: inherit;
text-decoration: none;
font-weight: 600;
}
.cart-layout {
display: grid;
grid-template-columns: minmax(0, 1fr) 340px;
gap: 28px;
align-items: start;
}
.cart-list-heading {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 18px;
}
.cart-list-heading h2,
.cart-summary h2 {
font-size: 20px;
font-weight: 750;
}
.cart-list-heading span {
color: #888;
font-size: 14px;
}
.cart-product {
display: grid;
grid-template-columns: 100px minmax(0, 1fr) 100px 130px;
align-items: center;
gap: 20px;
padding: 18px;
margin-bottom: 14px;
background: white;
border: 1px solid #eaeaea;
border-radius: 16px;
}
.cart-product-image {
width: 100px;
height: 100px;
display: flex;
align-items: center;
justify-content: center;
background: #f5f5f5;
border-radius: 12px;
overflow: hidden;
font-size: 35px;
}
.cart-product-image img {
width: 100%;
height: 100%;
object-fit: cover;
}
.cart-product-info h3 {
font-size: 17px;
font-weight: 700;
margin: 0 0 7px;
}
.cart-product-info p {
margin: 8px 0 0;
color: #777;
font-size: 14px;
}
.cart-category {
display: inline-block;
padding: 4px 9px;
background: #f1f1f1;
border-radius: 20px;
font-size: 12px;
color: #666;
}
.cart-product-quantity span {
display: block;
color: #888;
font-size: 12px;
margin-bottom: 5px;
}
.cart-product-quantity strong {
font-size: 15px;
}
.cart-product-price {
text-align: right;
font-size: 17px;
font-weight: 750;
}
.cart-summary {
background: white;
border: 1px solid #eaeaea;
border-radius: 18px;
padding: 24px;
position: sticky;
top: 25px;
}
.cart-summary h2 {
margin: 0 0 25px;
}
.cart-summary-row {
display: flex;
justify-content: space-between;
margin-bottom: 16px;
font-size: 14px;
color: #777;
}
.cart-summary-row strong {
color: #222;
}
.cart-summary-divider {
height: 1px;
background: #eaeaea;
margin: 22px 0;
}
.cart-summary-total {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 22px;
}
.cart-summary-total strong {
font-size: 23px;
font-weight: 800;
}
.cart-primary-button {
display: block;
width: 100%;
padding: 14px 18px;
border: none;
border-radius: 11px;
background: #222;
color: white;
text-align: center;
text-decoration: none;
font-weight: 700;
cursor: pointer;
}
.cart-primary-button:disabled {
opacity: 0.5;
cursor: not-allowed;
}
.cart-summary-note {
margin: 14px 0 0;
text-align: center;
font-size: 12px;
color: #888;
}
.cart-empty {
padding: 75px 20px;
text-align: center;
background: white;
border: 1px solid #eaeaea;
border-radius: 18px;
}
.cart-empty-icon {
font-size: 55px;
margin-bottom: 15px;
}
.cart-empty h2 {
font-size: 24px;
font-weight: 750;
}
.cart-empty p {
color: #777;
margin-bottom: 25px;
}
.cart-empty .cart-primary-button {
width: auto;
display: inline-block;
}
/* RESPONSIVE */
@media (max-width: 850px) {
.cart-layout {
grid-template-columns: 1fr;
}
.cart-summary {
position: static;
}
}
@media (max-width: 600px) {
.cart-header {
align-items: flex-start;
flex-direction: column;
}
.cart-product {
grid-template-columns: 75px 1fr;
gap: 12px;
}
.cart-product-image {
width: 75px;
height: 75px;
}
.cart-product-quantity {
grid-column: 2;
}
.cart-product-price {
grid-column: 2;
text-align: left;
}
}