faq page
This commit is contained in:
1 parent
50ec0eebf2
commit
1e4da2c8cc
73 files changed
+763
-43
No files matched your search
@@ -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
|
||||
Reference in new issue
Block a user