@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}'))
@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

$showAnim]) x-data="{ shown: false }" x-init="setTimeout(() => shown = true, 100)" :class="shown ? 'scale-100 opacity-100' : 'scale-95 opacity-0'"> {{ $text }}

@endif