price function global (needs review)

This commit is contained in:
elvira
2026-08-08 15:10:37 +03:00
parent e46276a31b
commit 7677d10821
8 changed files with 65 additions and 7 deletions
@@ -0,0 +1,9 @@
@props([
'amount' => null,
'currency' => '€',
])
{{-- No wrapper element on purpose — drop this inside whatever tag/classes
the call site already uses (span, p, etc). Formatting logic lives in
App\Support\Price so it's identical everywhere it's used. --}}
{{ \App\Support\Price::format($amount, $currency) }}
@@ -28,7 +28,7 @@ class="w-full h-auto block"
<div class="flex items-baseline justify-between gap-4">
<a href="{{ $href }}" class="font-bold text-xl leading-snug hover:text-brand">{{ $name }}</a>
@if($price !== null)
<span class="font-bold text-xl shrink-0">$ {{ $price }}</span>
<span class="font-bold text-xl shrink-0"><x-ui.price :amount="$price" /></span>
@endif
</div>
</div>
+3 -3
View File
@@ -33,7 +33,7 @@ class="font-display font-semibold text-6xl lg:text-7xl leading-tight"
aria-label="Προηγούμενο προϊόν"
class="absolute left-4 lg:left-8 top-1/2 -translate-y-1/2 hover:opacity-60 transition-opacity"
>
<x-ui.icon name="arrow-left" :size="56" />
<x-ui.icon name="arrow-left" :size="62" class="[&_path]:stroke-2" />
</button>
<div class="w-full ">
@@ -63,7 +63,7 @@ class="w-full h-full object-cover"
<div class="flex items-baseline justify-between gap-4">
<span class="font-display font-bold text-2xl">{{ $product['name'] }}</span>
@if($product['price'] !== null)
<span class="font-bold text-xl shrink-0">€{{ number_format($product['price'], 2) }}</span>
<span class="font-bold text-xl shrink-0"><x-ui.price :amount="$product['price']" /></span>
@endif
</div>
</a>
@@ -76,7 +76,7 @@ class="w-full h-full object-cover"
aria-label="Επόμενο προϊόν"
class="absolute right-4 lg:right-8 top-1/2 -translate-y-1/2 hover:opacity-60 transition-opacity"
>
<x-ui.icon name="arrow-right" :size="56" />
<x-ui.icon name="arrow-right" :size="62" class="[&_path]:stroke-2"/>
</button>
@else
<p class="text-neutral-500">Δεν βρέθηκαν προϊόντα.</p>
+1 -1
View File
@@ -152,7 +152,7 @@ class="absolute bottom-6 right-8 text-white text-sm"
@if($product->variants->first()?->prices->isNotEmpty())
<p class="text-2xl font-bold" data-product-form-target="price">
€{{ number_format($product->variants->first()->prices->first()->price->decimal, 2) }}
<x-ui.price :amount="$product->variants->first()->prices->first()->price->decimal" />
</p>
@endif
+1 -1
View File
@@ -152,7 +152,7 @@ class="absolute bottom-6 right-8 text-white text-sm"
@if($product->variants->first()?->prices->isNotEmpty())
<p class="text-2xl font-bold" data-product-form-target="price">
€{{ number_format($product->variants->first()->prices->first()->price->decimal, 2) }}
<x-ui.price :amount="$product->variants->first()->prices->first()->price->decimal" />
</p>
@endif