Skip to content

Commit

Permalink
feat: allow dynamically setting the card width on SimplePage
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphjsmit committed Nov 13, 2023
1 parent f3dfe3d commit df06eff
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,23 @@ class="absolute end-0 top-0 flex h-16 items-center gap-x-4 pe-4 md:pe-6 lg:pe-8"
class="fi-simple-main-ctn flex w-full flex-grow items-center justify-center"
>
<main
class="fi-simple-main my-16 w-full bg-white px-6 py-12 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10 sm:max-w-lg sm:rounded-xl sm:px-12"
@class([
'fi-simple-main my-16 w-full bg-white px-6 py-12 shadow-sm ring-1 ring-gray-950/5 dark:bg-gray-900 dark:ring-white/10 sm:rounded-xl sm:px-12',
match ($maxWidth) {
'xs' => 'sm:max-w-xs',
'sm' => 'sm:max-w-sm',
'md' => 'sm:max-w-md',
'lg' => 'sm:max-w-lg',
'xl' => 'sm:max-w-xl',
'2xl' => 'sm:max-w-2xl',
'3xl' => 'sm:max-w-3xl',
'4xl' => 'sm:max-w-4xl',
'5xl' => 'sm:max-w-5xl',
'6xl' => 'sm:max-w-6xl',
'7xl' => 'sm:max-w-7xl',
default => 'sm:max-w-lg',
},
])
>
{{ $slot }}
</main>
Expand Down
14 changes: 14 additions & 0 deletions packages/panels/src/Pages/SimplePage.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,20 @@ abstract class SimplePage extends BasePage
{
protected static string $layout = 'filament-panels::components.layout.simple';

protected ?string $maxWidth = null;

protected function getLayoutData(): array
{
return [
'maxWidth' => $this->getMaxWidth(),
];
}

public function getMaxWidth(): ?string
{
return $this->maxWidth;
}

public function hasLogo(): bool
{
return true;
Expand Down

0 comments on commit df06eff

Please sign in to comment.