Add title and menu to Page component
This commit is contained in:
parent
e664255d7c
commit
dbdadde542
|
@ -7,9 +7,10 @@ use Illuminate\View\Component;
|
|||
class Layout extends Component
|
||||
{
|
||||
|
||||
public function __construct(public string $pageClass = '', public string $title = '')
|
||||
public function __construct(public string $pageClass = '', public string $title = '', public string $menu = '')
|
||||
{
|
||||
session()->put('title', $title);
|
||||
session()->put('menu', $menu);
|
||||
}
|
||||
|
||||
public function userName(): string
|
||||
|
|
|
@ -18,13 +18,12 @@ class SettingLayout extends Component
|
|||
'is_active' => get_class($setting) === $active,
|
||||
'title' => $setting->title(),
|
||||
])->toArray();
|
||||
session()->put('menu', 'setting');
|
||||
}
|
||||
|
||||
public function render()
|
||||
{
|
||||
return <<<'HTML'
|
||||
<x-page::layout :title="$active::title()">
|
||||
<x-page::layout :title="$active::title()" menu="setting">
|
||||
<x-slot:right>
|
||||
{{ $right ?? '' }}
|
||||
</x-slot:right>
|
||||
|
|
|
@ -12,16 +12,13 @@ class DashboardComponent extends Component
|
|||
|
||||
public function mount(DashboardFactory $factory): void
|
||||
{
|
||||
session()->put('menu', 'dashboard');
|
||||
session()->put('title', 'Dashboard');
|
||||
|
||||
$this->blocks = $factory->load();
|
||||
}
|
||||
|
||||
public function render(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<x-page::layout>
|
||||
<x-page::layout title="Dashboard" menu="dashboard">
|
||||
<div class="gap-6 md:grid-cols-2 xl:grid-cols-4 grid p-6">
|
||||
@foreach($this->blocks as $block)
|
||||
<x-ui::box title="{{$block->title()}}" :second="true">
|
||||
|
|
Loading…
Reference in New Issue