%PDF- %PDF-
Direktori : /www/loslex/test/resources/views/components/ |
Current File : //www/loslex/test/resources/views/components/dropdown.blade.php |
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white dark:bg-gray-700', 'active']) @php switch ($align) { case 'left': $alignmentClasses = 'origin-top-left left-0'; break; case 'top': $alignmentClasses = 'origin-top'; break; case 'center': $alignmentClasses = 'origin-top -translate-x-1/2'; break; case 'right': default: $alignmentClasses = 'origin-top-right right-0'; break; } switch ($width) { case '48': $width = 'w-48'; break; case '72': $width = 'w-72'; break; case 'fit': $width = 'w-max'; break; } $classes = ($active ?? false) ? 'relative h-full border-b-2 border-indigo-400 dark:border-indigo-600' : 'relative h-full border-b-2 border-transparent hover:border-gray-300 dark:hover:border-gray-700' @endphp <div {!! $attributes->merge(['class' => $classes]) !!} x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false"> <div class="h-full" @click="open = ! open">{{ $trigger }}</div> <div x-show="open" x-transition:enter="transition ease-out duration-200" x-transition:enter-start="transform opacity-0 scale-95" x-transition:enter-end="transform opacity-100 scale-100" x-transition:leave="transition ease-in duration-75" x-transition:leave-start="transform opacity-100 scale-100" x-transition:leave-end="transform opacity-0 scale-95" class="absolute z-50 mt-2 {{ $width }} rounded-md shadow-lg {{ $alignmentClasses }}" style="display: none;" @click="open = false"> <div class="rounded-md ring-1 ring-black ring-opacity-5 {{ $contentClasses }}"> {{ $content }} </div> </div> </div>