2021-09-08 15:51:33 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Views\Components;
|
|
|
|
|
|
|
|
use ViewComponents\Component;
|
|
|
|
|
|
|
|
class Heading extends Component
|
|
|
|
{
|
2021-09-10 16:02:25 +00:00
|
|
|
protected string $tagName = 'div';
|
2021-09-08 15:51:33 +00:00
|
|
|
|
|
|
|
/**
|
2021-09-15 15:58:21 +00:00
|
|
|
* @var 'small'|'base'|'large'
|
2021-09-08 15:51:33 +00:00
|
|
|
*/
|
|
|
|
protected string $size = 'base';
|
|
|
|
|
|
|
|
public function render(): string
|
|
|
|
{
|
|
|
|
$sizeClasses = [
|
|
|
|
'small' => 'tracking-wide text-base',
|
2023-06-12 14:47:38 +00:00
|
|
|
'base' => 'text-xl',
|
2021-09-08 15:51:33 +00:00
|
|
|
'large' => 'text-3xl',
|
|
|
|
];
|
|
|
|
|
2021-11-05 14:36:34 +00:00
|
|
|
$class = $this->class . ' relative z-10 font-bold text-heading-foreground font-display before:w-full before:absolute before:h-1/2 before:left-0 before:bottom-0 before:rounded-full before:bg-heading-background before:z-[-10] ' . $sizeClasses[$this->size];
|
2021-09-08 15:51:33 +00:00
|
|
|
|
|
|
|
return <<<HTML
|
2021-09-10 16:02:25 +00:00
|
|
|
<{$this->tagName} class="{$class}">{$this->slot}</{$this->tagName}>
|
2021-09-08 15:51:33 +00:00
|
|
|
HTML;
|
|
|
|
}
|
|
|
|
}
|