diff --git a/packages/panels/docs/09-configuration.md b/packages/panels/docs/09-configuration.md index 2ae1636cd26..d7d2ec67b69 100644 --- a/packages/panels/docs/09-configuration.md +++ b/packages/panels/docs/09-configuration.md @@ -115,6 +115,20 @@ public function panel(Panel $panel): Panel } ``` +If you'd like to set the max content width for pages of the type `SimplePage`, like login and registration pages, you may do so using the `simplePageMaxContentWidth()` method. The default is `Large`: + +```php +use Filament\Panel; +use Filament\Support\Enums\MaxWidth; + +public function panel(Panel $panel): Panel +{ + return $panel + // ... + ->simplePageMaxContentWidth(MaxWidth::Small); +} +``` + ## Lifecycle hooks Hooks may be used to execute code during a panel's lifecycle. `bootUsing()` is a hook that gets run on every request that takes place within that panel. If you have multiple panels, only the current panel's `bootUsing()` will be run. The function gets run from middleware, after all service providers have been booted: @@ -230,7 +244,7 @@ use Filament\Resources\Pages\CreateRecord; class CreatePost extends CreateRecord { protected ?bool $hasDatabaseTransactions = false; - + // ... } ``` @@ -254,7 +268,7 @@ use Filament\Resources\Pages\CreateRecord; class CreatePost extends CreateRecord { protected ?bool $hasDatabaseTransactions = true; - + // ... } ``` diff --git a/packages/panels/resources/views/components/layout/simple.blade.php b/packages/panels/resources/views/components/layout/simple.blade.php index f5dafcfffb9..34895433e43 100644 --- a/packages/panels/resources/views/components/layout/simple.blade.php +++ b/packages/panels/resources/views/components/layout/simple.blade.php @@ -30,18 +30,29 @@ class="fi-simple-main-ctn flex w-full flex-grow items-center justify-center"
'sm:max-w-xs', - MaxWidth::Small, 'sm' => 'sm:max-w-sm', - MaxWidth::Medium, 'md' => 'sm:max-w-md', - MaxWidth::ExtraLarge, 'xl' => 'sm:max-w-xl', - MaxWidth::TwoExtraLarge, '2xl' => 'sm:max-w-2xl', - MaxWidth::ThreeExtraLarge, '3xl' => 'sm:max-w-3xl', - MaxWidth::FourExtraLarge, '4xl' => 'sm:max-w-4xl', - MaxWidth::FiveExtraLarge, '5xl' => 'sm:max-w-5xl', - MaxWidth::SixExtraLarge, '6xl' => 'sm:max-w-6xl', - MaxWidth::SevenExtraLarge, '7xl' => 'sm:max-w-7xl', - default => 'sm:max-w-lg', + match ($maxWidth ??= (filament()->getSimplePageMaxContentWidth() ?? MaxWidth::Large)) { + MaxWidth::ExtraSmall, 'xs' => 'max-w-xs', + MaxWidth::Small, 'sm' => 'max-w-sm', + MaxWidth::Medium, 'md' => 'max-w-md', + MaxWidth::Large, 'lg' => 'max-w-lg', + MaxWidth::ExtraLarge, 'xl' => 'max-w-xl', + MaxWidth::TwoExtraLarge, '2xl' => 'max-w-2xl', + MaxWidth::ThreeExtraLarge, '3xl' => 'max-w-3xl', + MaxWidth::FourExtraLarge, '4xl' => 'max-w-4xl', + MaxWidth::FiveExtraLarge, '5xl' => 'max-w-5xl', + MaxWidth::SixExtraLarge, '6xl' => 'max-w-6xl', + MaxWidth::SevenExtraLarge, '7xl' => 'max-w-7xl', + MaxWidth::Full, 'full' => 'max-w-full', + MaxWidth::MinContent, 'min' => 'max-w-min', + MaxWidth::MaxContent, 'max' => 'max-w-max', + MaxWidth::FitContent, 'fit' => 'max-w-fit', + MaxWidth::Prose, 'prose' => 'max-w-prose', + MaxWidth::ScreenSmall, 'screen-sm' => 'max-w-screen-sm', + MaxWidth::ScreenMedium, 'screen-md' => 'max-w-screen-md', + MaxWidth::ScreenLarge, 'screen-lg' => 'max-w-screen-lg', + MaxWidth::ScreenExtraLarge, 'screen-xl' => 'max-w-screen-xl', + MaxWidth::ScreenTwoExtraLarge, 'screen-2xl' => 'max-w-screen-2xl', + default => $maxWidth, }, ]) > diff --git a/packages/panels/src/FilamentManager.php b/packages/panels/src/FilamentManager.php index 2453fd9f56f..0065644098a 100644 --- a/packages/panels/src/FilamentManager.php +++ b/packages/panels/src/FilamentManager.php @@ -225,6 +225,11 @@ public function getMaxContentWidth(): MaxWidth | string | null return $this->getCurrentPanel()->getMaxContentWidth(); } + public function getSimplePageMaxContentWidth(): MaxWidth | string | null + { + return $this->getCurrentPanel()->getSimplePageMaxContentWidth(); + } + public function getModelResource(string | Model $model): ?string { return $this->getCurrentPanel()->getModelResource($model); diff --git a/packages/panels/src/Panel/Concerns/HasMaxContentWidth.php b/packages/panels/src/Panel/Concerns/HasMaxContentWidth.php index 1530f77d17a..44837ac5d45 100644 --- a/packages/panels/src/Panel/Concerns/HasMaxContentWidth.php +++ b/packages/panels/src/Panel/Concerns/HasMaxContentWidth.php @@ -8,6 +8,8 @@ trait HasMaxContentWidth { protected MaxWidth | string | null $maxContentWidth = null; + protected MaxWidth | string | null $simplePageMaxContentWidth = null; + public function maxContentWidth(MaxWidth | string | null $maxContentWidth): static { $this->maxContentWidth = $maxContentWidth; @@ -19,4 +21,16 @@ public function getMaxContentWidth(): MaxWidth | string | null { return $this->maxContentWidth; } + + public function simplePageMaxContentWidth(MaxWidth | string | null $width): static + { + $this->simplePageMaxContentWidth = $width; + + return $this; + } + + public function getSimplePageMaxContentWidth(): MaxWidth | string | null + { + return $this->simplePageMaxContentWidth; + } }