Fix product image: pass firstImage to Alpine, increase display size to h-96
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
Deploy to Production (witstore.wende.it) / deploy (push) Successful in 7s
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
@extends('layouts.shop')
|
@extends('layouts.shop')
|
||||||
@section('title', $product->name)
|
@section('title', $product->name)
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="grid grid-cols-1 md:grid-cols-2 gap-10 mb-12" x-data="productDetail(@json($product->variants))">
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-10 mb-12" x-data="productDetail(@json($product->variants), '{{ $product->images->count() ? asset('storage/'.$product->images->first()->path) : '' }}')">
|
||||||
|
|
||||||
{{-- Bilder --}}
|
{{-- Bilder --}}
|
||||||
<div>
|
<div>
|
||||||
@if($product->images->count())
|
@if($product->images->count())
|
||||||
<img :src="mainImage" x-init="mainImage = '{{ asset('storage/'.$product->images->first()->path) }}'" class="w-full rounded-lg mb-3 border">
|
<img :src="mainImage" class="w-full h-96 object-contain rounded-lg mb-3 border bg-gray-50">
|
||||||
<div class="flex gap-2 flex-wrap">
|
<div class="flex gap-2 flex-wrap">
|
||||||
@foreach($product->images as $img)
|
@foreach($product->images as $img)
|
||||||
<img src="{{ asset('storage/'.$img->path) }}" @click="mainImage = '{{ asset('storage/'.$img->path) }}'"
|
<img src="{{ asset('storage/'.$img->path) }}" @click="mainImage = '{{ asset('storage/'.$img->path) }}'"
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
@endforeach
|
@endforeach
|
||||||
</div>
|
</div>
|
||||||
@else
|
@else
|
||||||
<div class="w-full h-72 bg-gray-100 rounded-lg flex items-center justify-center text-7xl">📦</div>
|
<div class="w-full h-96 bg-gray-100 rounded-lg flex items-center justify-center text-7xl">📦</div>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -109,12 +109,12 @@
|
|||||||
@endif
|
@endif
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
function productDetail(variants) {
|
function productDetail(variants, firstImage) {
|
||||||
return {
|
return {
|
||||||
variants,
|
variants,
|
||||||
selectedAttrs: {},
|
selectedAttrs: {},
|
||||||
selectedVariant: null,
|
selectedVariant: null,
|
||||||
mainImage: '',
|
mainImage: firstImage,
|
||||||
currentPrice: {{ $product->base_price }},
|
currentPrice: {{ $product->base_price }},
|
||||||
selectAttr(name, id) {
|
selectAttr(name, id) {
|
||||||
this.selectedAttrs[name] = id;
|
this.selectedAttrs[name] = id;
|
||||||
|
|||||||
Reference in New Issue
Block a user