Creando modal propio
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" data-theme="corporate">
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}" data-theme="emerald">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
37
resources/views/components/my-modal.blade.php
Normal file
37
resources/views/components/my-modal.blade.php
Normal file
@@ -0,0 +1,37 @@
|
||||
<div x-data="{}"
|
||||
x-init="$refs.dialog.addEventListener('close', () => $dispatch('close-modal-{{$name}}'))"
|
||||
x-on:show-modal.window="
|
||||
console.log($event)
|
||||
if($event.detail[0] === '{{$name}}') {
|
||||
$refs.dialog.showModal();
|
||||
}
|
||||
"
|
||||
x-on:hide-modal.window="
|
||||
if($event.detail[0] === '{{$name}}') {
|
||||
$refs.dialog.close();
|
||||
}
|
||||
"
|
||||
>
|
||||
<dialog class="modal" x-ref="dialog" wire:ignore>
|
||||
<div class="modal-box">
|
||||
<form method="dialog">
|
||||
<button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">
|
||||
✕
|
||||
</button>
|
||||
</form>
|
||||
|
||||
@if(isset($title))
|
||||
<h3 class="text-lg font-bold">{{$title}}</h3>
|
||||
@endif
|
||||
|
||||
{{$slot}}
|
||||
|
||||
@if(isset($footer))
|
||||
<div class="modal-action">
|
||||
{{$footer}}
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
|
||||
</dialog>
|
||||
</div>
|
||||
Reference in New Issue
Block a user