Mercurial > packages > framework
comparison resources/views/components/dropdown.blade.php @ 1:56d9c64d64aa
Setting up the base, still have plenty of work to be done here.
| author | luka |
|---|---|
| date | Mon, 09 Jun 2025 23:07:17 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 0:07e7262a8cce | 1:56d9c64d64aa |
|---|---|
| 1 @props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white']) | |
| 2 | |
| 3 @php | |
| 4 $alignmentClasses = match ($align) { | |
| 5 'left' => 'ltr:origin-top-left rtl:origin-top-right start-0', | |
| 6 'top' => 'origin-top', | |
| 7 default => 'ltr:origin-top-right rtl:origin-top-left end-0', | |
| 8 }; | |
| 9 | |
| 10 $width = match ($width) { | |
| 11 '48' => 'w-48', | |
| 12 default => $width, | |
| 13 }; | |
| 14 @endphp | |
| 15 | |
| 16 <div class="relative" x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false"> | |
| 17 <div @click="open = ! open"> | |
| 18 {{ $trigger }} | |
| 19 </div> | |
| 20 | |
| 21 <div x-show="open" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="opacity-0 scale-95" | |
| 22 x-transition:enter-end="opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" | |
| 23 x-transition:leave-start="opacity-100 scale-100" x-transition:leave-end="opacity-0 scale-95" | |
| 24 class="absolute z-50 mt-2 {{ $width }} rounded-md shadow-lg {{ $alignmentClasses }}" | |
| 25 style="display: none;" @click="open = false"> | |
| 26 <div class="rounded-md ring-1 ring-black ring-opacity-5 {{ $contentClasses }}"> | |
| 27 {{ $content }} | |
| 28 </div> | |
| 29 </div> | |
| 30 </div> |
