Edit File: Avatar.php
<?php namespace Mary\View\Components; use Closure; use Illuminate\Contracts\View\View; use Illuminate\View\Component; class Avatar extends Component { public string $uuid; public function __construct( public ?string $image = '', // Slots public ?string $title = null, public ?string $subtitle = null ) { $this->uuid = "mary" . md5(serialize($this)); } public function render(): View|Closure|string { return <<<'HTML' <div class="flex items-center gap-2"> <div class="avatar"> <div {{ $attributes->class(["w-7 rounded-full"]) }}> <img src="{{ $image }}" /> </div> </div> @if($title || $subtitle) <div> @if($title) <div @class(["font-semibold font-lg", is_string($title) ? '' : $title?->attributes->get('class') ]) > {{ $title }} </div> @endif @if($subtitle) <div @class(["text-sm text-gray-400", is_string($subtitle) ? '' : $subtitle?->attributes->get('class') ]) > {{ $subtitle }} </div> @endif </div> @endif </div> HTML; } }
Back