Skip to content

Commit

Permalink
Add edit modal slide-over option (#31)
Browse files Browse the repository at this point in the history
* Add edit modal slideover option

* Update README.md

---------

Co-authored-by: Mo Khosh <[email protected]>
  • Loading branch information
ryanmortier and mokhosh committed Apr 8, 2024
1 parent 3a86761 commit f350ca6
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ The `data` array contains the form data, and the `state` array contains the full

### Customizing modal's appearance

You can customize modal's title, size and the labels for save and cancel buttons:
You can customize modal's title, size and the labels for save and cancel buttons, or use Filament's slide-over instead of a modal:

```php
protected string $editModalTitle = 'Edit Record';
Expand All @@ -205,6 +205,8 @@ protected string $editModalWidth = '2xl';
protected string $editModalSaveButtonLabel = 'Save';

protected string $editModalCancelButtonLabel = 'Cancel';

protected bool $editModalSlideOver = true;
```

## Customization
Expand Down
2 changes: 1 addition & 1 deletion resources/views/components/edit-record-modal.blade.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<x-filament-panels::form wire:submit.prevent="editModalFormSubmitted">
<x-filament::modal id="kanban--edit-record-modal" :width="$this->getEditModalWidth()">
<x-filament::modal id="kanban--edit-record-modal" :slideOver="$this->getEditModalSlideOver()" :width="$this->getEditModalWidth()">
<x-slot name="header">
<x-filament::modal.heading>
{{ $this->getEditModalTitle() }}
Expand Down
7 changes: 7 additions & 0 deletions src/Concerns/HasEditRecordModal.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ trait HasEditRecordModal

protected string $editModalTitle = 'Edit Record';

protected bool $editModalSlideOver = false;

protected string $editModalWidth = '2xl';

protected string $editModalSaveButtonLabel = 'Save';
Expand Down Expand Up @@ -81,6 +83,11 @@ protected function getEditModalTitle(): string
return $this->editModalTitle;
}

protected function getEditModalSlideOver(): bool
{
return $this->editModalSlideOver;
}

protected function getEditModalWidth(): string
{
return $this->editModalWidth;
Expand Down

0 comments on commit f350ca6

Please sign in to comment.