la_bloger/resources/views/themes/default/blocks/image.blade.php

23 lines
703 B
PHP

@php
$style = $block->content['style'] ?? 'contained';
$styleClass = match($style) {
'full' => 'w-full',
'float-left' => 'float-left mr-6 mb-4 w-1/2',
'float-right' => 'float-right ml-6 mb-4 w-1/2',
default => 'mx-auto max-w-2xl',
};
@endphp
<figure class="{{ $styleClass }}">
<img
src="{{ $block->content['url'] ?? '' }}"
alt="{{ $block->content['alt'] ?? '' }}"
class="w-full rounded"
loading="lazy"
>
@if(!empty($block->content['caption']))
<figcaption class="mt-2 text-sm text-center text-gray-500">
{{ $block->content['caption'] }}
</figcaption>
@endif
</figure>