Skip to content

Commit f668310

Browse files
committed
WIP
1 parent 81d8a0b commit f668310

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/View/Components/Modal.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
class Modal extends Component
1010
{
1111
public function __construct(
12-
public string $id,
12+
public ?string $id = '',
1313
public ?string $title = null,
1414
public ?string $subtitle = null,
1515
public ?bool $separator = false,
@@ -23,7 +23,18 @@ public function __construct(
2323
public function render(): View|Closure|string
2424
{
2525
return <<<'HTML'
26-
<dialog id="{{ $id }}" {{ $attributes->class(["modal"]) }}>
26+
<dialog
27+
{{ $attributes->class(["modal"]) }}
28+
29+
@if($id)
30+
id="{{ $id }}"
31+
@else
32+
x-data="{open: @entangle($attributes->wire('model')).live }"
33+
:class="{'modal-open': open}"
34+
:open="open"
35+
@keydown.escape.window = "$wire.{{ $attributes->wire('model')->value() }} = false"
36+
@endif
37+
>
2738
<div class="modal-box">
2839
@if($title)
2940
<x-header :title="$title" :subtitle="$subtitle" size="text-2xl" :separator="$separator" />

src/View/Components/Table.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ public function render(): View|Closure|string
7979
@endforeach
8080
</tbody>
8181
</table>
82+
@php
83+
# TODO: workaround for bug when using slot with @scope on tables.
84+
# It seems it loses start/end context with @scope/@endscope. So I am just placing any hidden component here.
85+
@endphp
86+
<x-alert style="display:none" />
8287
</div>
8388
HTML;
8489
}

0 commit comments

Comments
 (0)