43 lines
1.6 KiB
PHP
43 lines
1.6 KiB
PHP
@props(['station'])
|
|
|
|
@php
|
|
$colourClass = match($station['price_classification'] ?? '') {
|
|
'current' => 'text-green-500',
|
|
'recent' => 'text-slate-500',
|
|
'stale' => 'text-amber-500',
|
|
'outdated' => 'text-red-500',
|
|
default => 'text-zinc-400',
|
|
};
|
|
$miles = number_format(($station['distance_km'] ?? 0) * 0.621371, 1);
|
|
$price = number_format($station['price'] ?? 0, 1);
|
|
@endphp
|
|
|
|
<div class="flex items-center justify-between rounded-xl border border-[#e5ded7] bg-[#faf6f3] px-4 py-3.5">
|
|
<div class="min-w-0 flex-1">
|
|
<div class="flex items-center gap-2">
|
|
<p class="truncate text-sm font-bold text-[#4a3f3b]">
|
|
{{ $station['name'] ?? '' }}
|
|
</p>
|
|
@if (! empty($station['is_supermarket']))
|
|
<span class="shrink-0 rounded bg-lime-100 px-1.5 py-0.5 text-[10px] font-bold uppercase tracking-wide text-lime-700">
|
|
Supermarket
|
|
</span>
|
|
@endif
|
|
</div>
|
|
<p class="truncate text-xs text-[#89726c]">
|
|
{{ $station['address'] ?? '' }}, {{ $station['postcode'] ?? '' }}
|
|
</p>
|
|
<p class="text-xs text-[#b0a09a]">{{ $miles }} miles away</p>
|
|
</div>
|
|
|
|
<div class="ml-4 shrink-0 text-right">
|
|
<p class="text-xl font-black text-[#4a3f3b]">{{ $price }}p</p>
|
|
<p class="text-[11px] {{ $colourClass }}">
|
|
{{ $station['price_classification_label'] ?? '' }}
|
|
@if (! empty($station['price_updated_at']))
|
|
· {{ \Carbon\Carbon::parse($station['price_updated_at'])->diffForHumans() }}
|
|
@endif
|
|
</p>
|
|
</div>
|
|
</div>
|