Skip to content

Commit

Permalink
refactor: allow dropdown component without button (#570)
Browse files Browse the repository at this point in the history
  • Loading branch information
alexbarnsley authored May 31, 2023
1 parent ca27d6d commit c0dce6e
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions resources/views/dropdown.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
'onClose' => null,
'disabled' => false,
'withPlacement' => false,
'withoutButton' => false,
])

<div
Expand Down Expand Up @@ -56,21 +57,23 @@
@if($wrapperClass) class="{{ $wrapperClass }}" @endif
@if($dusk) dusk="{{ $dusk }}" @endif
>
<div>
<button
type="button"
:class="{ '{{ $buttonClassExpanded }}' : {{ $dropdownProperty }}, '{{ $buttonClassClosed }}' : !{{ $dropdownProperty }} }"
class="flex items-center focus:outline-none dropdown-button transition-default {{ $buttonClass }}"
@if($disabled) disabled @else @click="{{ $dropdownProperty }} = !{{ $dropdownProperty }}" @endif
@if($buttonTooltip) data-tippy-content="{{ $buttonTooltip }}" @endif
>
@if($button ?? false)
{{ $button }}
@else
<x-ark-icon name="ellipsis-vertical" />
@endif
</button>
</div>
@unless($withoutButton)
<div>
<button
type="button"
:class="{ '{{ $buttonClassExpanded }}' : {{ $dropdownProperty }}, '{{ $buttonClassClosed }}' : !{{ $dropdownProperty }} }"
class="flex items-center focus:outline-none dropdown-button transition-default {{ $buttonClass }}"
@if($disabled) disabled @else @click="{{ $dropdownProperty }} = !{{ $dropdownProperty }}" @endif
@if($buttonTooltip) data-tippy-content="{{ $buttonTooltip }}" @endif
>
@if($button ?? false)
{{ $button }}
@else
<x-ark-icon name="ellipsis-vertical" />
@endif
</button>
</div>
@endunless

<div
x-show="{{ $dropdownProperty }}"
Expand Down

0 comments on commit c0dce6e

Please sign in to comment.