pianello-api/resources/views/components/base/menu/button.blade.php
Ale Gallo 96c0bfb8ce Committing laravel (part 5)
committing blade templating files and components that might come in handy
2023-11-10 16:41:20 +01:00

17 lines
686 B
PHP

@props(['as' => 'div'])
@if (substr($as, 0, 2) == 'x-')
<x-dynamic-component
data-tw-toggle="dropdown"
aria-expanded="false"
{{ $attributes->class(['cursor-pointer'])->merge($attributes->whereDoesntStartWith('class')->getAttributes()) }}
:component="substr($as, 2)"
>{{ $slot }}</x-dynamic-component>
@else
<{{ $as }}
data-tw-toggle="dropdown"
aria-expanded="false"
{{ $attributes->whereDoesntStartWith('href')->class(['cursor-pointer'])->merge($attributes->whereDoesntStartWith(['class', 'href'])->getAttributes())->merge($as == 'a' ? ['href' => 'javascript:;'] : []) }}
>{{ $slot }}
</{{ $as }}>
@endif