@props([
'c' => [],
'tag' => 'h2',
'size' => 'display',
'regularClass' => 'heading-regular',
'accentClass' => 'heading-accent',
'regular' => null,
'accent' => null,
'break' => null,
'balance' => true,
])
@php
$regularText = $regular ?? ($c['title_regular'] ?? '');
$accentText = $accent ?? ($c['title_accent'] ?? '');
$breakMode = $break ?? ($c['title_break'] ?? 'inline');
$sizeClass = match ($size) {
'hero' => 'text-hero',
'h3' => 'text-h3',
default => 'text-display',
};
$regularLines = preg_split('/\n/', (string) $regularText);
@endphp
<{{ $tag }} {{ $attributes->class([$sizeClass, 'text-balance' => $balance, 'text-pretty' => ! $balance]) }}>
@if ($regularText !== '')
@foreach ($regularLines as $line){{ $line }}@if (! $loop->last)
@endif @endforeach
@endif
@if ($accentText !== '')
@if ($breakMode === 'newline')
@endif
{{ $accentText }}
@endif
{{ $tag }}>