diff --git a/README.md b/README.md index c8c9d2d..08b59a7 100644 --- a/README.md +++ b/README.md @@ -120,6 +120,8 @@ public function panel(Panel $panel): Panel ### Appearance +#### Rounded + By default, the Quick Create button will be fully rounded if you would like to have a more square button you can disable the rounding with the `rounded()` method. ```php @@ -135,6 +137,40 @@ public function panel(Panel $panel): Panel } ``` +#### Hiding Icons + +If you prefer to not show icons for the items in the menu you can disable them with the `hiddenIcons()` method. + +```php +use Awcodes\FilamentQuickCreate\QuickCreatePlugin; + +public function panel(Panel $panel): Panel +{ + return $panel + ->plugins([ + QuickCreatePlugin::make() + ->hiddenIcons(), + ]) +} +``` + +#### Settings label + +If you prefer to show a label with the plus icon you can set it using the `label()` method and passing your label to it. + +```php +use Awcodes\FilamentQuickCreate\QuickCreatePlugin; + +public function panel(Panel $panel): Panel +{ + return $panel + ->plugins([ + QuickCreatePlugin::make() + ->label('New'), + ]) +} +``` + ### Slide Overs By default, Quick Create will render simple resources in a standard modal. If you would like to render them in a slide over instead you may use the `slideOver()` modifier to do so. diff --git a/resources/views/components/create-menu.blade.php b/resources/views/components/create-menu.blade.php index 4a2c765..2f692dc 100644 --- a/resources/views/components/create-menu.blade.php +++ b/resources/views/components/create-menu.blade.php @@ -4,9 +4,11 @@ @foreach($resources as $resource) resources = QuickCreatePlugin::get()->getResources(); $this->rounded = QuickCreatePlugin::get()->isRounded(); + $this->hiddenIcons = QuickCreatePlugin::get()->shouldHideIcons(); + $this->label = QuickCreatePlugin::get()->getLabel(); } /** diff --git a/src/QuickCreatePlugin.php b/src/QuickCreatePlugin.php index 6110a4e..effc619 100644 --- a/src/QuickCreatePlugin.php +++ b/src/QuickCreatePlugin.php @@ -34,6 +34,10 @@ class QuickCreatePlugin implements Plugin protected string | Closure | null $renderUsingHook = null; + protected bool | Closure | null $hiddenIcons = null; + + protected string | Closure | null $label = null; + public function boot(Panel $panel): void { Livewire::component('quick-create-menu', Components\QuickCreateMenu::class); @@ -207,4 +211,28 @@ public function getRenderHook(): string { return $this->evaluate($this->renderUsingHook) ?? PanelsRenderHook::USER_MENU_BEFORE; } + + public function hiddenIcons(bool | Closure $condition = true): static + { + $this->hiddenIcons = $condition; + + return $this; + } + + public function shouldHideIcons(): bool + { + return $this->evaluate($this->hiddenIcons) ?? false; + } + + public function label(string | Closure $label): static + { + $this->label = $label; + + return $this; + } + + public function getLabel(): ?string + { + return $this->evaluate($this->label) ?? null; + } }