Skip to content

Commit 96d36f5

Browse files
authored
Add ability to click commands (#37)
1 parent b53f210 commit 96d36f5

3 files changed

Lines changed: 18 additions & 5 deletions

File tree

README.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,13 @@ class CreateUser extends SpotlightCommand
204204
{
205205
return SpotlightCommandDependencies::collection()
206206
->add(SpotlightCommandDependency::make('team')->setPlaceholder('For which team do you want to create a user?'))
207-
->add(SpotlightCommandDependency::make('name')->setPlaceholder('How do you want to name this user?')->setType(SpotlightCommandDependency::INPUT));
207+
->add(SpotlightCommandDependency::make('foobar')->setPlaceholder('Search for second dependency')
208+
);
209+
}
210+
211+
public function searchFoobar($query, User $user)
212+
{
213+
// Given Foobar is the second dependency it will have access to any resolved depedencies defined earlier. In this case we can access the User which was chosen.
208214
}
209215

210216
public function searchTeam($query)
@@ -394,6 +400,12 @@ return [
394400
];
395401
```
396402

403+
If you want to change the spotlight view, you can also publish the views.
404+
405+
```shell
406+
php artisan vendor:publish --tag=livewire-ui-spotlight-views
407+
```
408+
397409
## Credits
398410

399411
- [Philo Hermans](https://github.com/philoNL)

config/livewire-ui-spotlight.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,9 @@
5050
|--------------------------------------------------------------------------
5151
|
5252
| Spotlight will inject the required Javascript in your blade template.
53-
| If you want to bundle the required Javascript you can set this to false
54-
| run `npm install --save fuse.js` and add `require('vendor/livewire-ui/spotlight/resources/js/spotlight');`
53+
| If you want to bundle the required Javascript you can set this to false,
54+
| call 'npm install fuse.js' or 'yarn add fuse.js',
55+
| then add `require('vendor/livewire-ui/spotlight/resources/js/spotlight');`
5556
| to your script bundler like webpack.
5657
|
5758
*/

resources/views/spotlight.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
@keydown.window.escape="isOpen = false"
1818
@toggle-spotlight.window="toggleOpen()"
1919
class="fixed z-50 px-4 pt-16 flex items-start justify-center inset-0 sm:pt-24">
20-
<div x-show="isOpen" x-transition:enter="ease-out duration-200" x-transition:enter-start="opacity-0"
20+
<div x-show="isOpen" @click="isOpen = false" x-transition:enter="ease-out duration-200" x-transition:enter-start="opacity-0"
2121
x-transition:enter-end="opacity-100" x-transition:leave="ease-in duration-150"
2222
x-transition:leave-start="opacity-100" x-transition:leave-end="opacity-0"
2323
class="fixed inset-0 transition-opacity">
2424
<div class="absolute inset-0 bg-gray-900 opacity-50"></div>
2525
</div>
2626

27-
<div @click.outside="isOpen = false" x-show="isOpen" x-transition:enter="ease-out duration-200"
27+
<div x-show="isOpen" x-transition:enter="ease-out duration-200"
2828
x-transition:enter-start="opacity-0 scale-95" x-transition:enter-end="opacity-100 scale-100"
2929
x-transition:leave="ease-in duration-150" x-transition:leave-start="opacity-100 scale-100"
3030
x-transition:leave-end="opacity-0 scale-95"

0 commit comments

Comments
 (0)