faq page
This commit is contained in:
1 parent
50ec0eebf2
commit
1e4da2c8cc
73 files changed
+763
-43
No files matched your search
@@ -12,6 +12,7 @@
|
||||
<ul class="flex flex-wrap justify-center items-center gap-x-8 gap-y-3 font-semibold uppercase">
|
||||
<li><a href="{{ route('contact') }}" class="underline-slide [--slide-h:5px] font-extrabold italic">{{ __('storefront.nav.contact') }}</a></li>
|
||||
<li><a href="{{ route('legal.shipping-returns') }}" class="underline-slide [--slide-h:5px] font-extrabold italic">{{ __('storefront.footer.shipping_returns') }}</a></li>
|
||||
<li><a href="{{ route('faq') }}" class="underline-slide [--slide-h:5px] font-extrabold italic">{{ __('storefront.nav.faq') }}</a></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
||||
@@ -30,6 +30,9 @@
|
||||
{{-- Contact --}}
|
||||
<a href="{{ route('contact') }}" class="nav-link uppercase inline-flex items-center gap-1 relative font-display font-extrabold italic text-black no-underline"><span>{{ __('storefront.nav.contact') }}</span></a>
|
||||
|
||||
{{-- FAQ --}}
|
||||
<a href="{{ route('faq') }}" class="nav-link uppercase inline-flex items-center gap-1 relative font-display font-extrabold italic text-black no-underline"><span>{{ __('storefront.nav.faq') }}</span></a>
|
||||
|
||||
</nav>
|
||||
|
||||
{{-- Right side actions — language, wishlist and account move into the mobile menu below `lg` --}}
|
||||
@@ -154,6 +157,16 @@ class="mobile-menu fixed inset-x-0 top-20 bottom-auto m-0 max-h-[calc(100dvh-5re
|
||||
<x-ui.icon name="arrow-right" :size="22" />
|
||||
</a>
|
||||
</li>
|
||||
<li>
|
||||
<a
|
||||
href="{{ route('faq') }}"
|
||||
@class(['nav-link uppercase flex items-center justify-between gap-4', 'is-active' => request()->routeIs('faq')])
|
||||
@if (request()->routeIs('faq')) aria-current="page" @endif
|
||||
>
|
||||
<span>{{ __('storefront.nav.faq') }}</span>
|
||||
<x-ui.icon name="arrow-right" :size="22" />
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<ul class="flex flex-col gap-4 border-t border-black pt-6">
|
||||
|
||||
@@ -34,6 +34,8 @@
|
||||
|
||||
'arrow-down' => '<path fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M12 5V19M12 19L6 13M12 19L18 13"/>',
|
||||
|
||||
'chevron-down' => '<path fill="none" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" d="M6 9L12 15L18 9"/>',
|
||||
|
||||
'facebook' => '<path d="M14 13.5H16.5L17.5 9.5H14V7.5C14 6.47062 14 5.5 16 5.5H17.5V2.1401C17.1743 2.09685 15.943 2 14.6429 2C11.9284 2 10 3.65686 10 6.69971V9.5H7V13.5H10V22H14V13.5Z"/>',
|
||||
|
||||
'tiktok' => '<path d="M16 8.24537V15.5C16 19.0899 13.0899 22 9.5 22C5.91015 22 3 19.0899 3 15.5C3 11.9101 5.91015 9 9.5 9C10.0163 9 10.5185 9.06019 11 9.17393V12.3368C10.5454 12.1208 10.0368 12 9.5 12C7.567 12 6 13.567 6 15.5C6 17.433 7.567 19 9.5 19C11.433 19 13 17.433 13 15.5V2H16C16 4.76142 18.2386 7 21 7V10C19.1081 10 17.3696 9.34328 16 8.24537Z"/>',
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
src="{{ $image }}"
|
||||
alt="{{ $name }}"
|
||||
loading="lazy"
|
||||
class="w-full h-auto block"
|
||||
class="w-full h-auto block {{ $soldOut ? 'opacity-50' : '' }}"
|
||||
>
|
||||
@else
|
||||
<div class="w-full aspect-square bg-neutral-300 flex items-center justify-center text-neutral-500 text-sm">
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', $page->meta_title ?: $page->name)
|
||||
@section('description', $page->meta_description)
|
||||
@section('og_image', $page->og_image)
|
||||
|
||||
{{-- FAQPage structured data, this page only (not on product pages, where the
|
||||
same answers would repeat). --}}
|
||||
@if ($sections->isNotEmpty())
|
||||
@push('seo')
|
||||
<script type="application/ld+json">
|
||||
{!! json_encode([
|
||||
'@@context' => 'https://schema.org', {{-- @@ escapes Blade's @context directive --}}
|
||||
'@type' => 'FAQPage',
|
||||
'mainEntity' => $sections->flatMap->items->map(fn ($faq) => [
|
||||
'@type' => 'Question',
|
||||
'name' => $faq->name,
|
||||
'acceptedAnswer' => [
|
||||
'@type' => 'Answer',
|
||||
'text' => trim(strip_tags($faq->answer)),
|
||||
],
|
||||
])->all(),
|
||||
], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_HEX_TAG) !!}
|
||||
</script>
|
||||
@endpush
|
||||
@endif
|
||||
|
||||
@section('content')
|
||||
|
||||
@php $number = 0; @endphp
|
||||
|
||||
<section class="grid grid-cols-1 lg:grid-cols-2">
|
||||
|
||||
{{-- Photo: left column on desktop (sticky while the questions scroll),
|
||||
after the questions on mobile so the answers come first. --}}
|
||||
<div class="order-last border-t border-black px-5 py-12 sm:px-8 lg:order-none lg:border-t-0 lg:border-r lg:p-10" data-stoic="pages/faq#image">
|
||||
@if (! empty($page->image))
|
||||
<x-ui.stoic-image
|
||||
src="{{ $page->image }}"
|
||||
preset="large"
|
||||
sizes="(min-width: 1024px) 50vw, 100vw"
|
||||
:alt="$page->image_alt ?? ''"
|
||||
:aria-hidden="blank($page->image_alt) ? 'true' : null"
|
||||
loading="eager"
|
||||
fetchpriority="high"
|
||||
:preload="true"
|
||||
class="w-full h-auto lg:sticky lg:top-42"
|
||||
/>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
<div class="flex flex-col gap-10 px-5 py-12 sm:px-8 lg:py-16 lg:px-10">
|
||||
|
||||
<div class="flex flex-col gap-6">
|
||||
<h1 class="font-display text-h2 font-extrabold leading-tight" data-stoic="pages/faq#heading">
|
||||
{{ $page->heading ?: $page->name }}
|
||||
</h1>
|
||||
|
||||
@if (filled($page->intro))
|
||||
<p class="max-w-xl" data-stoic="pages/faq#intro">{{ $page->intro }}</p>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
@foreach ($sections as $section)
|
||||
<section id="{{ $section->slug }}" class="flex flex-col scroll-mt-28" aria-labelledby="{{ $section->slug }}-heading">
|
||||
{{-- <h2 id="{{ $section->slug }}-heading" class="mb-2 font-display text-h4 font-extrabold" data-stoic="faq-sections/{{ $section->slug }}#name"> --}}
|
||||
<h2 id="{{ $section->slug }}-heading" class="mb-2 font-display text-sm font-semibold uppercase" data-stoic="faq-sections/{{ $section->slug }}#name">
|
||||
{{ $section->name }}
|
||||
</h2>
|
||||
|
||||
@foreach ($section->items as $faq)
|
||||
@php $number++; @endphp
|
||||
|
||||
<details id="{{ $faq->slug }}" class="group scroll-mt-28">
|
||||
<summary class="flex cursor-pointer list-none items-center gap-4 border-b border-transparent py-4 font-display text-2xl font-bold group-open:border-black [&::-webkit-details-marker]:hidden">
|
||||
<span class="w-8 shrink-0 tabular-nums" aria-hidden="true">{{ str_pad($number, 2, '0', STR_PAD_LEFT) }}</span>
|
||||
<span class="flex-1" data-stoic="faqs/{{ $faq->slug }}#name">{{ $faq->name }}</span>
|
||||
<x-ui.icon name="chevron-down" size="22" class="transition-transform duration-300 group-open:rotate-180" />
|
||||
</summary>
|
||||
|
||||
<div class="legal-content pt-4 pb-6 pl-12 text-base" data-stoic="faqs/{{ $faq->slug }}#body">
|
||||
{!! $faq->answer !!}
|
||||
</div>
|
||||
</details>
|
||||
@endforeach
|
||||
</section>
|
||||
@endforeach
|
||||
|
||||
</div>
|
||||
|
||||
</section>
|
||||
|
||||
@endsection
|
||||
@@ -9,7 +9,7 @@
|
||||
@push('seo')
|
||||
<script type="application/ld+json">
|
||||
{!! json_encode(array_filter([
|
||||
'@context' => 'https://schema.org',
|
||||
'@@context' => 'https://schema.org', {{-- @@ escapes Blade's @context directive --}}
|
||||
'@type' => 'Organization',
|
||||
'name' => app(\Modules\Core\Store\Services\StoreDetailsService::class)->current()->translate('name') ?: config('app.name'),
|
||||
'url' => url('/'),
|
||||
@@ -69,7 +69,7 @@ class="{{ $loop->first ? '' : 'hidden' }} group h-full flex flex-col justify-cen
|
||||
loading="eager"
|
||||
fetchpriority="high"
|
||||
preload="{{ $loop->first ? true : false }}"
|
||||
class="w-full h-full object-cover"
|
||||
class="w-full h-full object-cover {{ ($product['soldOut'] ?? false) ? 'opacity-50' : '' }}"
|
||||
>
|
||||
@else
|
||||
<span class="text-neutral-500 text-sm">{{ __('storefront.product.no_image') }}</span>
|
||||
|
||||
Reference in new issue
Block a user