<?php

namespace App\Http\Livewire;

use Livewire\Component;

class MainContainer extends Component
{
    public $currentContent = 'Patch';
    public $loading = false;

    protected $listeners = ['menuChanged' => 'loadContent'];

    public function loadContent($menu)
    {
        $this->loading = true;

        // Simulate loading delay
        // sleep(1);

        $this->currentContent = $menu;
        $this->emitTo('pages.patch.patch-index', 'showpatchListForm');
        // $this->emitTo('PatchIndex', 'showpatchListForm');
        $this->loading = false;
    }

    public function render()
    {
        return view('livewire.main-container');
    }

}
