Implemented a block editor for changing the layout of the page
This commit is contained in:
36
resources/views/components/blocks/benefits.blade.php
Normal file
36
resources/views/components/blocks/benefits.blade.php
Normal file
@@ -0,0 +1,36 @@
|
||||
@props(['block'])
|
||||
|
||||
@php
|
||||
/** @var \App\Models\PageBlock $block */
|
||||
$c = $block->content ?? [];
|
||||
$title = data_get($c, 'title');
|
||||
$items = data_get($c, 'items', []);
|
||||
$layout = (string) data_get($c, 'layout', 'list');
|
||||
$cols = (int) data_get($c, 'max_columns', 2);
|
||||
$gridClass = $layout === 'grid'
|
||||
? match ($cols) {
|
||||
3 => 'sm:grid-cols-3',
|
||||
1 => 'sm:grid-cols-1',
|
||||
default => 'sm:grid-cols-2',
|
||||
}
|
||||
: '';
|
||||
@endphp
|
||||
|
||||
<div class="w-full space-y-4" x-show="phase !== 'thanks'" x-cloak>
|
||||
@if (filled($title))
|
||||
<h2 class="text-center text-lg font-semibold text-white sm:text-xl">{{ $title }}</h2>
|
||||
@endif
|
||||
|
||||
@if (is_array($items) && $items !== [])
|
||||
<ul class="{{ $layout === 'grid' ? 'grid grid-cols-1 gap-3 '.$gridClass : 'space-y-3' }} w-full text-left">
|
||||
@foreach ($items as $item)
|
||||
@if (is_array($item))
|
||||
<li class="flex gap-3 rounded-xl border border-white/15 bg-black/25 px-4 py-3">
|
||||
<x-blocks.icon :name="(string) ($item['icon'] ?? 'check')" class="mt-0.5 text-festival" />
|
||||
<span class="text-sm leading-snug text-white/95 sm:text-[15px]">{{ $item['text'] ?? '' }}</span>
|
||||
</li>
|
||||
@endif
|
||||
@endforeach
|
||||
</ul>
|
||||
@endif
|
||||
</div>
|
||||
Reference in New Issue
Block a user