Skip to content

Commit

Permalink
Merge pull request #1527 from DissNik/3.x-offcanvas
Browse files Browse the repository at this point in the history
wide offcanvas
  • Loading branch information
lee-to authored Feb 7, 2025
2 parents c42f3ba + 4460e97 commit 64c9f3c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/UI/resources/views/components/off-canvas.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
'name' => 'default',
'open' => $isOpen ?? false,
'left' => $isLeft ?? false,
'wide' => $isWide ?? false,
'title' => '',
'async' => false,
'asyncUrl' => '',
Expand Down Expand Up @@ -45,7 +46,12 @@
x-transition:leave-start="opacity-100 translate-x-0"
x-transition:leave-end="opacity-0 translate-x-full"
@endif
class="offcanvas offcanvas-{{ $left ? 'left' : 'right' }}"
@class([
'offcanvas',
'offcanvas-left' => $left,
'offcanvas-right' => !$left,
'w-full max-w-none' => $wide,
])
aria-modal="true"
role="dialog"
>
Expand Down
10 changes: 10 additions & 0 deletions src/UI/src/Components/OffCanvas.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ final class OffCanvas extends AbstractWithComponents

protected bool $open = false;

protected bool $wide = false;

protected array $togglerAttributes = [];

public function __construct(
Expand Down Expand Up @@ -50,6 +52,13 @@ public function left(Closure|bool|null $condition = null): self
return $this;
}

public function wide(Closure|bool|null $condition = null): self
{
$this->wide = \is_null($condition) || value($condition, $this);

return $this;
}

public function togglerAttributes(array $attributes): self
{
$this->togglerAttributes = $attributes;
Expand Down Expand Up @@ -90,6 +99,7 @@ protected function viewData(): array
{
return [
'isLeft' => $this->left,
'isWide' => $this->wide,
'isOpen' => $this->open,
'title' => value($this->title, $this),
'async' => ! empty($this->asyncUrl),
Expand Down

0 comments on commit 64c9f3c

Please sign in to comment.