2021-10-13 15:43:40 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
namespace App\Views\Components;
|
|
|
|
|
|
|
|
use ViewComponents\Component;
|
|
|
|
|
|
|
|
class ReadMore extends Component
|
|
|
|
{
|
2022-03-04 14:33:48 +00:00
|
|
|
public string $id;
|
|
|
|
|
2021-10-13 15:43:40 +00:00
|
|
|
public function render(): string
|
|
|
|
{
|
|
|
|
$readMoreLabel = lang('Common.read_more');
|
|
|
|
$readLessLabel = lang('Common.read_less');
|
|
|
|
return <<<HTML
|
|
|
|
<div class="read-more {$this->class}" style="--line-clamp: 3">
|
|
|
|
<input id="read-more-checkbox_{$this->id}" type="checkbox" class="read-more__checkbox" aria-hidden="true">
|
|
|
|
<div class="mb-2 read-more__text">{$this->slot}</div>
|
|
|
|
<label for="read-more-checkbox_{$this->id}" class="read-more__label" data-read-more="{$readMoreLabel}" data-read-less="{$readLessLabel}" aria-hidden="true"></label>
|
|
|
|
</div>
|
|
|
|
HTML;
|
|
|
|
}
|
|
|
|
}
|