wire-elements / spotlight

Livewire component that brings Spotlight/Alfred-like functionality to your Laravel application.
MIT License
927 stars 72 forks source link

Close already open modals when a new modal opens with Spotlight? #44

Closed seabasss closed 2 years ago

seabasss commented 3 years ago

This is really cool!

I'm trying it out with modals and it works pretty well, but is there any way to close all other modals if I open a new one with Spotlight? This didn't work:

public function execute(Spotlight $spotlight)
{
    $spotlight->emit('closeModal'); // forceful too if possible
    $spotlight->emit('openModal', 'create-user');
}

Also, is there any way to change the standard Logout out of your account to Log out of your account.

Edit // I guess I can just re-create that class in my Spotlight folder.

Thanks again, love it!

PhiloNL commented 3 years ago

Hi @seabasss

Happy to hear you think it's really cool! If you open a new modal, the previous modal should be hidden. Or do you mean if you open a new modal and close it, the previously opened modal will display?

seabasss commented 3 years ago

If I have a modal that is open and then use spotlight to open another modal, I want the first modal and any other hidden modals to close first. Right now I get back to the previous modal when I close the modal that spotlight opened.

I know I can add forceful close on the lw component for the modal I open with spotlight, but I also open that modal without spotlight other times and don’t want it forceful in that case :)

I guess I could send a variable from spotlight that will activate forceful, but wondering if there’s a cleaner way.

PhiloNL commented 2 years ago

I don't have a solution for this at this time but if you have an idea on how to tackle this feel free to create a PR :)