Skip to content

Commit

Permalink
conditional application in blade
Browse files Browse the repository at this point in the history
  • Loading branch information
johntrickett86 committed Nov 4, 2024
1 parent 80ec014 commit fd1d5b6
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions resources/views/components/create-menu.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,26 @@
->implode('.');
@endphp

<div class="quick-create-component" x-data="{ dropdownOpen: false }">
<div class="quick-create-component"
@if($keyBindings)
x-data="{
toggleDropdown() {
this.$refs.triggerButton.click()
this.$refs.triggerButton.focus()
}
}"
@endif
>
@if ($resources && $this->shouldBeHidden() === false)
<x-filament::dropdown placement="bottom-end" :teleport="true">
<x-slot name="trigger">
<button
x-ref="triggerButton"
@click="dropdownOpen = !dropdownOpen"
x-mousetrap.global.{{ $keyBindings }}="$refs.triggerButton.click()"
@if($keyBindings)
x-ref="triggerButton"
x-mousetrap.global.{{ $keyBindings }}="toggleDropdown"
@endif
@class([
'flex flex-shrink-0 bg-gray-100 items-center justify-center text-primary-500 hover:text-primary-900 dark:bg-gray-800 hover:bg-primary-500 dark:hover:bg-primary-500',
'rounded-full' => $rounded,
Expand Down

0 comments on commit fd1d5b6

Please sign in to comment.