التواصل
contact-15
قسم مواقع في المنتصف: بطاقتان للمكاتب، لكل منهما صورة والمدينة والعنوان ورابط للاتجاهات.
{{--
Centred locations section: one card per office with a photo, city,
address and a directions link. Every piece of content is a prop. A
location is ['name' => ..., 'address' => ...] plus optional 'href' (the
directions link, which defaults to a Google Maps search for the address)
and 'image' => ['src' => ..., 'alt' => ...]. Without an image src the
card shows a placeholder.
<x-ui.blocks.contact-15
tagline="Offices"
heading="Where to find us"
description="Two studios, one team."
:locations="[
['name' => 'Sydney', 'address' => '1 Market St, Sydney NSW 2000', 'image' => ['src' => '/img/sydney.jpg', 'alt' => 'Sydney studio']],
['name' => 'Auckland', 'address' => '2 Queen St, Auckland 1010', 'image' => ['src' => '/img/auckland.jpg', 'alt' => 'Auckland studio']],
]"
directions-label="Get directions"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Locations',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'locations' => [
['name' => 'Sydney', 'address' => '123 Sample St, Sydney NSW 2000 AU'],
['name' => 'New York', 'address' => '123 Sample St, New York NY 10000 USA'],
],
'directionsLabel' => 'Get Directions',
])
<section {{ $attributes->merge(['class' => 'w-full bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto flex max-w-7xl flex-col items-center gap-12 md:gap-20">
<div class="flex w-full max-w-3xl flex-col items-center gap-3 text-center md:gap-4">
@if ($tagline)
<p class="font-semibold">{{ $tagline }}</p>
@endif
<div class="flex flex-col gap-5 md:gap-6">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
@if ($description)
<p class="md:text-lg">{{ $description }}</p>
@endif
</div>
</div>
<div class="grid w-full grid-cols-1 gap-12 md:grid-cols-2 md:gap-16">
@foreach ($locations as $location)
@php
$image = $location['image'] ?? [];
$address = $location['address'] ?? '';
$href = $location['href'] ?? 'https://www.google.com/maps/search/?api=1&query=' . urlencode($address);
@endphp
<div class="flex flex-col items-center gap-6 md:gap-8">
<div class="aspect-[3/2] w-full overflow-hidden bg-muted">
@if (!empty($image['src']))
<img src="{{ $image['src'] }}" alt="{{ $image['alt'] ?? '' }}" loading="lazy"
class="size-full object-cover">
@else
<div class="flex size-full items-center justify-center text-muted-foreground">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round" class="size-12 md:size-20" aria-hidden="true">
<rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
<circle cx="9" cy="9" r="2" />
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
</svg>
</div>
@endif
</div>
<div class="flex flex-col items-center gap-5 text-center md:gap-6">
<div class="flex flex-col gap-3 md:gap-4">
<h3 class="text-2xl font-bold leading-[1.3] md:text-[2rem]">{{ $location['name'] ?? '' }}</h3>
<address class="not-italic">{{ $address }}</address>
</div>
@if ($directionsLabel)
<x-ui.button variant="link" href="{{ $href }}"
class="h-auto p-0 text-base font-normal text-foreground has-[>svg]:px-0">
{{ $directionsLabel }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="size-5 rtl:rotate-180" aria-hidden="true">
<path d="m9 18 6-6-6-6" />
</svg>
</x-ui.button>
@endif
</div>
</div>
@endforeach
</div>
</div>
</section>
التثبيت
php artisan ui:add-block contact-15
أمر واحد يثبّت ملف Blade الخاص بالقالب وكل مكوّن يعتمد عليه. اعرضه في تخطيطك كالتالي
<x-ui.blocks.contact-15
/>.
المكونات المضمّنة
1. ثبّت المكونات المطلوبة
php artisan ui:add button
2. حزم خارجية
- composer:
gehrisandro/tailwind-merge-laravel
3.
انسخ كود القالب إلى
resources/views/components/ui/
resources/views/components/ui/blocks/contact-15.blade.php
{{--
Centred locations section: one card per office with a photo, city,
address and a directions link. Every piece of content is a prop. A
location is ['name' => ..., 'address' => ...] plus optional 'href' (the
directions link, which defaults to a Google Maps search for the address)
and 'image' => ['src' => ..., 'alt' => ...]. Without an image src the
card shows a placeholder.
<x-ui.blocks.contact-15
tagline="Offices"
heading="Where to find us"
description="Two studios, one team."
:locations="[
['name' => 'Sydney', 'address' => '1 Market St, Sydney NSW 2000', 'image' => ['src' => '/img/sydney.jpg', 'alt' => 'Sydney studio']],
['name' => 'Auckland', 'address' => '2 Queen St, Auckland 1010', 'image' => ['src' => '/img/auckland.jpg', 'alt' => 'Auckland studio']],
]"
directions-label="Get directions"
/>
--}}
@props([
'tagline' => 'Tagline',
'heading' => 'Locations',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'locations' => [
['name' => 'Sydney', 'address' => '123 Sample St, Sydney NSW 2000 AU'],
['name' => 'New York', 'address' => '123 Sample St, New York NY 10000 USA'],
],
'directionsLabel' => 'Get Directions',
])
<section {{ $attributes->merge(['class' => 'w-full bg-background px-[5%] py-16 text-foreground md:py-24 lg:py-28']) }}>
<div class="mx-auto flex max-w-7xl flex-col items-center gap-12 md:gap-20">
<div class="flex w-full max-w-3xl flex-col items-center gap-3 text-center md:gap-4">
@if ($tagline)
<p class="font-semibold">{{ $tagline }}</p>
@endif
<div class="flex flex-col gap-5 md:gap-6">
<h2 class="text-4xl font-bold leading-[1.2] md:text-5xl">{{ $heading }}</h2>
@if ($description)
<p class="md:text-lg">{{ $description }}</p>
@endif
</div>
</div>
<div class="grid w-full grid-cols-1 gap-12 md:grid-cols-2 md:gap-16">
@foreach ($locations as $location)
@php
$image = $location['image'] ?? [];
$address = $location['address'] ?? '';
$href = $location['href'] ?? 'https://www.google.com/maps/search/?api=1&query=' . urlencode($address);
@endphp
<div class="flex flex-col items-center gap-6 md:gap-8">
<div class="aspect-[3/2] w-full overflow-hidden bg-muted">
@if (!empty($image['src']))
<img src="{{ $image['src'] }}" alt="{{ $image['alt'] ?? '' }}" loading="lazy"
class="size-full object-cover">
@else
<div class="flex size-full items-center justify-center text-muted-foreground">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="1.5" stroke-linecap="round"
stroke-linejoin="round" class="size-12 md:size-20" aria-hidden="true">
<rect width="18" height="18" x="3" y="3" rx="2" ry="2" />
<circle cx="9" cy="9" r="2" />
<path d="m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" />
</svg>
</div>
@endif
</div>
<div class="flex flex-col items-center gap-5 text-center md:gap-6">
<div class="flex flex-col gap-3 md:gap-4">
<h3 class="text-2xl font-bold leading-[1.3] md:text-[2rem]">{{ $location['name'] ?? '' }}</h3>
<address class="not-italic">{{ $address }}</address>
</div>
@if ($directionsLabel)
<x-ui.button variant="link" href="{{ $href }}"
class="h-auto p-0 text-base font-normal text-foreground has-[>svg]:px-0">
{{ $directionsLabel }}
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"
stroke="currentColor" stroke-width="2" stroke-linecap="round"
stroke-linejoin="round" class="size-5 rtl:rotate-180" aria-hidden="true">
<path d="m9 18 6-6-6-6" />
</svg>
</x-ui.button>
@endif
</div>
</div>
@endforeach
</div>
</div>
</section>
الاستخدام
Centred locations section: one card per office with a photo, city, address and a directions link. Every piece of content is a prop. A location is ['name' => ..., 'address' => ...] plus optional 'href' (the directions link, which defaults to a Google Maps search for the address) and 'image' => ['src' => ..., 'alt' => ...]. Without an image src the card shows a placeholder.
<x-ui.blocks.contact-15
tagline="Offices"
heading="Where to find us"
description="Two studios, one team."
:locations="[
['name' => 'Sydney', 'address' => '1 Market St, Sydney NSW 2000', 'image' => ['src' => '/img/sydney.jpg', 'alt' => 'Sydney studio']],
['name' => 'Auckland', 'address' => '2 Queen St, Auckland 1010', 'image' => ['src' => '/img/auckland.jpg', 'alt' => 'Auckland studio']],
]"
directions-label="Get directions"
/>
الخصائص
كل خاصية مع قيمتها الافتراضية. مرّر أيًّا منها كسمة، واستخدم : لربط قيمة PHP.
@props([
'tagline' => 'Tagline',
'heading' => 'Locations',
'description' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.',
'locations' => [
['name' => 'Sydney', 'address' => '123 Sample St, Sydney NSW 2000 AU'],
['name' => 'New York', 'address' => '123 Sample St, New York NY 10000 USA'],
],
'directionsLabel' => 'Get Directions',
])