34 lines
1.3 KiB
PHP
34 lines
1.3 KiB
PHP
@props([
|
|
'block',
|
|
'subscriberCount' => 0,
|
|
])
|
|
|
|
@php
|
|
/** @var \App\Models\PageBlock $block */
|
|
$c = $block->content ?? [];
|
|
$min = (int) data_get($c, 'min_count', 0);
|
|
$template = (string) data_get($c, 'template', '');
|
|
$style = (string) data_get($c, 'style', 'pill');
|
|
$showAnim = filter_var(data_get($c, 'show_animation', true), FILTER_VALIDATE_BOOLEAN);
|
|
@endphp
|
|
|
|
@if ($subscriberCount >= $min && str_contains($template, '{count}'))
|
|
<div
|
|
class="w-full text-center"
|
|
x-show="phase !== 'thanks'"
|
|
x-cloak
|
|
>
|
|
@php
|
|
$text = str_replace('{count}', number_format($subscriberCount, 0, ',', '.'), $template);
|
|
$wrapClass = match ($style) {
|
|
'badge' => 'inline-flex rounded-lg border border-white/20 bg-white/10 px-4 py-2 text-sm text-white',
|
|
'plain' => 'text-sm text-white/90',
|
|
default => 'inline-flex rounded-full border border-festival/40 bg-festival/15 px-5 py-2 text-sm font-medium text-white shadow-inner',
|
|
};
|
|
@endphp
|
|
<p @class([$wrapClass, 'transition-transform duration-500' => $showAnim]) x-data="{ shown: false }" x-init="setTimeout(() => shown = true, 100)" :class="shown ? 'scale-100 opacity-100' : 'scale-95 opacity-0'">
|
|
{{ $text }}
|
|
</p>
|
|
</div>
|
|
@endif
|