Skip to content

Commit

Permalink
Replace switch with match in dropdown.blade.php (#393)
Browse files Browse the repository at this point in the history
  • Loading branch information
osbre authored Jul 5, 2024
1 parent d97b472 commit 3752607
Showing 1 changed file with 9 additions and 17 deletions.
26 changes: 9 additions & 17 deletions stubs/default/resources/views/components/dropdown.blade.php
Original file line number Diff line number Diff line change
@@ -1,24 +1,16 @@
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white dark:bg-gray-700'])

@php
switch ($align) {
case 'left':
$alignmentClasses = 'ltr:origin-top-left rtl:origin-top-right start-0';
break;
case 'top':
$alignmentClasses = 'origin-top';
break;
case 'right':
default:
$alignmentClasses = 'ltr:origin-top-right rtl:origin-top-left end-0';
break;
}
$alignmentClasses = match ($align) {
'left' => 'ltr:origin-top-left rtl:origin-top-right start-0',
'top' => 'origin-top',
default => 'ltr:origin-top-right rtl:origin-top-left end-0',
};
switch ($width) {
case '48':
$width = 'w-48';
break;
}
$width = match ($width) {
'48' => 'w-48',
default => $width,
};
@endphp

<div class="relative" x-data="{ open: false }" @click.outside="open = false" @close.stop="open = false">
Expand Down

0 comments on commit 3752607

Please sign in to comment.