XetaIO /
Xetaravel
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Xetaravel\View\Components; |
||
| 6 | |||
| 7 | use Closure; |
||
| 8 | use Illuminate\Contracts\View\View; |
||
| 9 | use Illuminate\Support\Str; |
||
| 10 | use Illuminate\View\Component; |
||
| 11 | |||
| 12 | class Header extends Component |
||
| 13 | { |
||
| 14 | public string $anchor = ''; |
||
| 15 | |||
| 16 | public function __construct( |
||
| 17 | public ?string $title = null, |
||
| 18 | public ?string $subtitle = null, |
||
| 19 | public ?bool $separator = false, |
||
| 20 | public ?string $progressIndicator = null, |
||
| 21 | public ?bool $withAnchor = false, |
||
| 22 | public ?string $size = 'text-2xl', |
||
| 23 | |||
| 24 | // Slots |
||
| 25 | public mixed $middle = null, |
||
| 26 | public mixed $actions = null, |
||
| 27 | ) { |
||
| 28 | $this->anchor = Str::slug($title); |
||
| 29 | } |
||
| 30 | |||
| 31 | public function progressTarget(): ?string |
||
| 32 | { |
||
| 33 | if ($this->progressIndicator === 1) { |
||
|
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
| 34 | return $this->attributes->whereStartsWith('progress-indicator')->first(); |
||
| 35 | } |
||
| 36 | |||
| 37 | return $this->progressIndicator; |
||
| 38 | } |
||
| 39 | |||
| 40 | /** |
||
| 41 | * Get the view / contents that represent the component. |
||
| 42 | */ |
||
| 43 | public function render(): View|Closure|string |
||
| 44 | { |
||
| 45 | return view('components.header'); |
||
| 46 | } |
||
| 47 | } |
||
| 48 |