Skip to content

Commit f38aae5

Browse files
committed
Refactor modal components to use x-dynamic-component
Replaces static Filament component tags with <x-dynamic-component> in modal-related Blade views. This change improves flexibility and consistency in how modal components are rendered and allows for easier customization and extension.
1 parent 47d7e17 commit f38aae5

File tree

6 files changed

+54
-29
lines changed

6 files changed

+54
-29
lines changed

resources/css/custom-nestable-item.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,5 +106,15 @@
106106
}
107107

108108
.filament-tree-component .nestable-menu {
109-
@apply flex gap-2 mb-4;
109+
@apply mb-4;
110+
}
111+
.filament-tree-component .nestable-menu,
112+
.filament-tree-component .nestable-menu .toolbar-btns {
113+
@apply flex items-center gap-2;
114+
}
115+
.filament-tree-component .nestable-menu {
116+
@apply justify-between;
117+
}
118+
.filament-tree-component .nestable-menu .toolbar-btns.main {
119+
@apply flex-1;
110120
}

resources/views/components/actions/index.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,4 @@ function ($action) use ($record): bool {
2121
);
2222
@endphp
2323

24-
<x-filament::actions :actions="$actions" :alignment="$alignment" class="fi-tree-actions"/>
24+
<x-filament::actions :actions="$actions" :alignment="$alignment" :fullWidth="true" class="fi-tree-actions"/>
Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
<x-filament::actions
1+
<x-dynamic-component
2+
component="filament::actions"
3+
:actions="$actions ?? []"
4+
:alignment="$alignment ?? null"
5+
:fullWidth="$fullWidth ?? false"
26
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
3-
:alignment="config('filament.layout.actions.modal.actions.alignment')"
4-
:dark-mode="config('filament.dark_mode')"
57
>
68
{{ $slot }}
7-
</x-filament::actions>
9+
</x-dynamic-component>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<x-filament::modal.heading
1+
<x-dynamic-component
2+
component="filament::modal.heading"
23
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
3-
:dark-mode="\Filament\Facades\Filament::hasDarkMode()"
44
>
55
{{ $slot }}
6-
</x-filament::modal.heading>
6+
</x-dynamic-component>
Lines changed: 30 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
1-
@captureSlots([
2-
'actions',
3-
'content',
4-
'footer',
5-
'header',
6-
'heading',
7-
'subheading',
8-
'trigger',
9-
])
10-
11-
<x-filament::modal
12-
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->merge($slots)"
13-
:dark-mode="\Filament\Facades\Filament::hasDarkMode()"
14-
heading-component="filament-tree::modal.heading"
15-
{{-- hr-component="tables::hr" --}}
16-
subheading-component="filament-tree::modal.subheading"
1+
<x-dynamic-component
2+
component="filament::modal.index"
3+
:alignment="$alignment ?? null"
4+
:ariaLabelledby="$ariaLabelledby ?? null"
5+
:autofocus="$autofocus ?? null"
6+
:closeButton="$closeButton ?? null"
7+
:closeByClickingAway="$closeByClickingAway ?? null"
8+
:closeByEscaping="$closeByEscaping ?? null"
9+
:closeEventName="$closeEventName ?? null"
10+
:closeQuietlyEventName="$closeQuietlyEventName ?? null"
11+
:description="$description ?? null"
12+
:extraModalWindowAttributeBag="$extraModalWindowAttributeBag ?? null"
13+
:footer="$footer ?? null"
14+
:footerActions="$footerActions ?? null"
15+
:footerActionsAlignment="$footerActionsAlignment ?? null"
16+
:header="$header ?? null"
17+
:heading="$heading ?? null"
18+
:icon="$icon ?? null"
19+
:iconAlias="$iconAlias ?? null"
20+
:iconColor="$iconColor ?? null"
21+
:id="$id ?? null"
22+
:openEventName="$openEventName ?? null"
23+
:slideOver="$slideOver ?? null"
24+
:stickyFooter="$stickyFooter ?? null"
25+
:stickyHeader="$stickyHeader ?? null"
26+
:trigger="$trigger ?? null"
27+
:visible="$visible ?? null"
28+
:width="$width ?? null"
29+
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
1730
>
1831
{{ $slot }}
19-
</x-filament::modal>
32+
</x-dynamic-component>
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<x-filament::modal.description
1+
<x-dynamic-component
2+
component="filament::modal.description"
23
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)"
3-
:dark-mode="\Filament\Facades\Filament::hasDarkMode()"
44
>
55
{{ $slot }}
6-
</x-filament::modal.description>
6+
</x-dynamic-component>

0 commit comments

Comments
 (0)