responsive design
This commit is contained in:
1 parent
9217960de0
commit
0ae5f49bcf
23 files changed
+380
-157
No files matched your search
@@ -6,7 +6,7 @@
|
||||
@section('content')
|
||||
<div class="max-w-7xl mx-auto px-4 sm:px-8 py-12">
|
||||
|
||||
<x-breadcrumb class="mb-14 justify-end" :items="[
|
||||
<x-breadcrumb class="mb-8 justify-end lg:mb-14" :items="[
|
||||
$collection
|
||||
? ['label' => $collection['name'], 'href' => route('category.show', ['id' => $collection['id']])]
|
||||
: ['label' => __('storefront.nav.products'), 'href' => route('products')],
|
||||
@@ -24,27 +24,28 @@ class="grid grid-cols-1 md:grid-cols-2 gap-12"
|
||||
|
||||
{{-- Image --}}
|
||||
{{-- relative: anchors the wishlist heart to the top right, which is
|
||||
the main image's corner (thumbnails sit on the left). --}}
|
||||
the main image's corner (thumbnails sit on the left at `lg`,
|
||||
in a horizontally scrolling row under the image below it). --}}
|
||||
<div
|
||||
data-controller="product-gallery"
|
||||
class="relative flex gap-4 items-start"
|
||||
class="relative flex flex-col-reverse gap-4 lg:flex-row lg:items-start"
|
||||
>
|
||||
<x-wishlist-button :product-id="$product['id']" class="absolute top-4 right-4 z-10" />
|
||||
|
||||
@if(!empty($product['media']))
|
||||
{{-- Thumbnails --}}
|
||||
<div class="flex flex-col items-center gap-1 w-[116px] shrink-0 -mt-12.5">
|
||||
<div class="flex flex-col items-center gap-1 w-full shrink-0 lg:w-[116px] lg:-mt-12.5">
|
||||
<button
|
||||
type="button"
|
||||
data-action="click->product-gallery#scrollUp"
|
||||
data-product-gallery-target="arrow"
|
||||
class="gallery-arrow invisible w-full flex items-center justify-center py-2"
|
||||
class="gallery-arrow invisible max-lg:hidden w-full flex items-center justify-center py-2"
|
||||
aria-label="Scroll thumbnails up"
|
||||
><x-ui.icon name="arrow-up" :size="30" /></button>
|
||||
|
||||
<div
|
||||
data-product-gallery-target="track"
|
||||
class="flex flex-col gap-4 overflow-hidden"
|
||||
class="flex w-full gap-4 overflow-x-auto lg:flex-col lg:overflow-hidden"
|
||||
style="max-height: var(--gallery-height, 600px)"
|
||||
>
|
||||
@foreach($product['media'] as $i => $media)
|
||||
@@ -54,7 +55,7 @@ class="flex flex-col gap-4 overflow-hidden"
|
||||
data-product-gallery-target="thumb"
|
||||
data-src="{{ $media['url'] }}"
|
||||
data-alt="{{ $product['name'] }}"
|
||||
class="block w-full shrink-0 border border-black overflow-hidden "
|
||||
class="block w-20 shrink-0 border border-black overflow-hidden lg:w-full"
|
||||
aria-label="View image {{ $i + 1 }}"
|
||||
aria-pressed="{{ $i === 0 ? 'true' : 'false' }}"
|
||||
>
|
||||
@@ -69,7 +70,7 @@ class="block w-full shrink-0 border border-black overflow-hidden "
|
||||
type="button"
|
||||
data-action="click->product-gallery#scrollDown"
|
||||
data-product-gallery-target="arrow"
|
||||
class="gallery-arrow invisible w-full flex items-center justify-center py-2"
|
||||
class="gallery-arrow invisible max-lg:hidden w-full flex items-center justify-center py-2"
|
||||
aria-label="Scroll thumbnails down"
|
||||
><x-ui.icon name="arrow-down" :size="30" /></button>
|
||||
</div>
|
||||
@@ -77,7 +78,7 @@ class="gallery-arrow invisible w-full flex items-center justify-center py-2"
|
||||
{{-- Main image --}}
|
||||
<button
|
||||
type="button"
|
||||
class="flex-1 border border-black bg-white cursor-zoom-in block p-0"
|
||||
class="w-full border border-black bg-white cursor-zoom-in block p-0 lg:w-auto lg:flex-1"
|
||||
data-action="click->product-gallery#openLightbox"
|
||||
aria-label="View full size image"
|
||||
>
|
||||
@@ -105,9 +106,9 @@ class="product-lightbox"
|
||||
<button
|
||||
type="button"
|
||||
data-action="click->product-gallery#prevImage click->product-gallery#noop"
|
||||
class="lightbox-arrow absolute left-8 top-1/2 -translate-y-1/2"
|
||||
class="lightbox-arrow absolute left-4 bottom-4 lg:left-8 lg:bottom-auto lg:top-1/2 lg:-translate-y-1/2"
|
||||
aria-label="Previous image"
|
||||
><x-ui.icon name="arrow-left" :size="72" color="white" /></button>
|
||||
><x-ui.icon name="arrow-left" :size="72" color="white" class="max-lg:size-12!" /></button>
|
||||
|
||||
{{-- Image + close button as a unit --}}
|
||||
<div class="relative" data-action="click->product-gallery#noop">
|
||||
@@ -115,13 +116,13 @@ class="lightbox-arrow absolute left-8 top-1/2 -translate-y-1/2"
|
||||
data-product-gallery-target="lightboxImage"
|
||||
src=""
|
||||
alt=""
|
||||
class="max-h-[90vh] max-w-[80vw] object-contain block"
|
||||
class="max-h-[75vh] max-w-[calc(100vw-2rem)] object-contain block lg:max-h-[90vh] lg:max-w-[80vw]"
|
||||
>
|
||||
<button
|
||||
type="button"
|
||||
popovertarget="product-lightbox"
|
||||
popovertargetaction="hide"
|
||||
class="lightbox-close absolute -top-10 -right-10"
|
||||
class="lightbox-close absolute -top-12 right-0 lg:-top-10 lg:-right-10"
|
||||
aria-label="Close gallery"
|
||||
><x-ui.icon name="close" :size="36" color="white" /></button>
|
||||
</div>
|
||||
@@ -130,14 +131,14 @@ class="lightbox-close absolute -top-10 -right-10"
|
||||
<button
|
||||
type="button"
|
||||
data-action="click->product-gallery#nextImage click->product-gallery#noop"
|
||||
class="lightbox-arrow absolute right-8 top-1/2 -translate-y-1/2"
|
||||
class="lightbox-arrow absolute right-4 bottom-4 lg:right-8 lg:bottom-auto lg:top-1/2 lg:-translate-y-1/2"
|
||||
aria-label="Next image"
|
||||
><x-ui.icon name="arrow-right" :size="72" color="white" /></button>
|
||||
><x-ui.icon name="arrow-right" :size="72" color="white" class="max-lg:size-12!" /></button>
|
||||
|
||||
{{-- Counter --}}
|
||||
<p
|
||||
data-product-gallery-target="lightboxCounter"
|
||||
class="absolute bottom-6 right-8 text-white text-sm"
|
||||
class="absolute bottom-8 left-1/2 -translate-x-1/2 text-white text-sm lg:left-auto lg:right-8 lg:bottom-6 lg:translate-x-0"
|
||||
aria-live="polite"
|
||||
></p>
|
||||
</div>
|
||||
@@ -212,9 +213,9 @@ class="flex flex-col gap-6"
|
||||
<x-product-custom-fields :fields="$product['custom_fields']" />
|
||||
@endif
|
||||
|
||||
<div class="flex items-stretch gap-10">
|
||||
<div class="flex items-stretch gap-4 sm:gap-10">
|
||||
<x-ui.quantity name="quantity" />
|
||||
<x-ui.button type="submit" class="flex-1" data-product-form-target="submit" :disabled="! ($initialVariant['inStock'] ?? true)">{{ __('storefront.product.add_to_cart') }}</x-ui.button>
|
||||
<x-ui.button type="submit" class="flex-1 max-sm:px-6" data-product-form-target="submit" :disabled="! ($initialVariant['inStock'] ?? true)">{{ __('storefront.product.add_to_cart') }}</x-ui.button>
|
||||
</div>
|
||||
</x-checkout::add-to-cart>
|
||||
|
||||
@@ -228,7 +229,7 @@ class="flex flex-col gap-6"
|
||||
|
||||
</div>
|
||||
|
||||
<x-ui.tabs id="product-tabs" class="mt-16 scroll-mt-28" size="lg" :active="request('tab')" :tabs="[
|
||||
<x-ui.tabs id="product-tabs" class="mt-12 scroll-mt-28 lg:mt-16" size="lg" :active="request('tab')" :tabs="[
|
||||
['id' => 'description', 'label' => __('storefront.product.description')],
|
||||
['id' => 'reviews', 'label' => __('storefront.product.reviews') . ' (' . $product['reviews']['count'] . ')'],
|
||||
]">
|
||||
@@ -271,7 +272,7 @@ class="flex flex-col gap-6"
|
||||
|
||||
@if(!empty($product['recommendations']))
|
||||
<x-product-grid
|
||||
class="mt-20"
|
||||
class="mt-16 lg:mt-20"
|
||||
:title="__('storefront.product.related')"
|
||||
:products="collect($product['recommendations'])->map(fn (array $recommendation) => [
|
||||
'name' => $recommendation['name'],
|
||||
@@ -286,6 +287,6 @@ class="mt-20"
|
||||
|
||||
</div>
|
||||
|
||||
<x-newsletter class="py-20" />
|
||||
<x-newsletter class="py-12 lg:py-20" />
|
||||
|
||||
@endsection
|
||||
Reference in new issue
Block a user