Skip to content

Commit

Permalink
[2.x] Allow custom classes on the dropdown class (#661)
Browse files Browse the repository at this point in the history
* Allow custom classes on the dropdown class

Use case: a person may want to show the dropdown on the left on mobile, but to the right on the web. Currently they don't have an option for that. So they could do:

`left-0 md:right-0`

* Update dropdown.blade.php

* Update dropdown.blade.php

* Update dropdown.blade.php

* Update dropdown.blade.php

* Update dropdown.blade.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
natecorkish and taylorotwell authored Feb 5, 2021
1 parent 9996dfd commit 15e8b37
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions resources/views/components/dropdown.blade.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white'])
@props(['align' => 'right', 'width' => '48', 'contentClasses' => 'py-1 bg-white', 'dropdownClasses' => ''])

@php
switch ($align) {
Expand All @@ -8,6 +8,10 @@
case 'top':
$alignmentClasses = 'origin-top';
break;
case 'none':
case 'false':
$alignmentClasses = '';
break;
case 'right':
default:
$alignmentClasses = 'origin-top-right right-0';
Expand All @@ -33,7 +37,7 @@
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 }}"
class="absolute z-50 mt-2 {{ $width }} rounded-md shadow-lg {{ $alignmentClasses }} {{ $dropdownClasses }}"
style="display: none;"
@click="open = false">
<div class="rounded-md ring-1 ring-black ring-opacity-5 {{ $contentClasses }}">
Expand Down

0 comments on commit 15e8b37

Please sign in to comment.