Skip to content

Commit

Permalink
Fix styling
Browse files Browse the repository at this point in the history
  • Loading branch information
datlechin authored and github-actions[bot] committed Aug 1, 2024
1 parent d6eba08 commit 8da12ac
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
12 changes: 6 additions & 6 deletions src/Livewire/MenuItems.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
use Livewire\Attributes\On;
use Livewire\Component;

class MenuItems extends Component implements HasForms, HasActions
class MenuItems extends Component implements HasActions, HasForms
{
use InteractsWithForms;
use InteractsWithActions;
use InteractsWithForms;

public Menu $menu;

Expand All @@ -48,7 +48,7 @@ public function reorder(array $order, ?string $parentId = null): void
->update([
'order' => DB::raw(
'case ' . collect($order)
->map(fn($recordKey, int $recordIndex): string => 'when id = ' . DB::getPdo()->quote($recordKey) . ' then ' . ($recordIndex + 1))
->map(fn ($recordKey, int $recordIndex): string => 'when id = ' . DB::getPdo()->quote($recordKey) . ' then ' . ($recordIndex + 1))
->implode(' ') . ' end',
),
'parent_id' => $parentId,
Expand All @@ -73,9 +73,9 @@ public function editAction(): Action
->label(__('filament-actions::edit.single.label'))
->iconButton()
->size(ActionSize::Small)
->modalHeading(fn(array $arguments): string => __('filament-actions::edit.single.modal.heading', ['label' => $arguments['title']]))
->modalHeading(fn (array $arguments): string => __('filament-actions::edit.single.modal.heading', ['label' => $arguments['title']]))
->icon('heroicon-m-pencil-square')
->fillForm(fn(array $arguments): array => MenuItem::query()
->fillForm(fn (array $arguments): array => MenuItem::query()
->where('id', $arguments['id'])
->select(['id', 'title', 'url', 'is_external'])
->first()
Expand Down Expand Up @@ -110,7 +110,7 @@ public function deleteAction(): Action
->iconButton()
->size(ActionSize::Small)
->requiresConfirmation()
->modalHeading(fn(array $arguments): string => __('filament-actions::delete.single.modal.heading', ['label' => $arguments['title']]))
->modalHeading(fn (array $arguments): string => __('filament-actions::delete.single.modal.heading', ['label' => $arguments['title']]))
->modalSubmitActionLabel(__('filament-actions::delete.single.modal.actions.delete.label'))
->modalIcon(FilamentIcon::resolve('actions::delete-action.modal') ?? 'heroicon-o-trash')
->action(function (array $arguments): void {
Expand Down
4 changes: 2 additions & 2 deletions src/Livewire/MenuPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function add(): void
$order = $this->menu->menuItems()->max('order') ?? 0;

$selectedItems = collect($this->items)
->filter(fn($item) => in_array($item['title'], $this->data))
->filter(fn ($item) => in_array($item['title'], $this->data))
->map(function ($item) use (&$order) {
return [
...$item,
Expand All @@ -65,7 +65,7 @@ public function form(Form $form): Form
->hiddenLabel()
->required()
->bulkToggleable()
->options(collect($this->items)->mapWithKeys(fn($item) => [$item['title'] => $item['title']])),
->options(collect($this->items)->mapWithKeys(fn ($item) => [$item['title'] => $item['title']])),
]);
}

Expand Down
4 changes: 2 additions & 2 deletions src/MenuPanel/MenuPanel.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class MenuPanel

public static function make(): static
{
return new static();
return new static;
}

public function heading(string $heading): static
Expand All @@ -22,7 +22,7 @@ public function heading(string $heading): static
return $this;
}

public function addItem(string $title, \Closure|string $url): static
public function addItem(string $title, \Closure | string $url): static
{
$this->items[] = [
'title' => $title,
Expand Down
4 changes: 2 additions & 2 deletions src/MenuPanel/StaticMenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ class StaticMenu

public static function make(): static
{
return new static();
return new static;
}

public function add(string $title, \Closure|string $url): static
public function add(string $title, \Closure | string $url): static
{
$this->items[] = [
'title' => $title,
Expand Down
2 changes: 1 addition & 1 deletion src/Models/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ public function linkable(): MorphTo

protected function type(): Attribute
{
return Attribute::get(fn() => $this->linkable ? $this->linkable->title : 'Liên kết tùy chỉnh');
return Attribute::get(fn () => $this->linkable ? $this->linkable->title : 'Liên kết tùy chỉnh');
}
}
2 changes: 1 addition & 1 deletion src/Resources/MenuResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public static function form(Form $form): Form
->label('Tên')
->required(),
Radio::make('location')
->visible(fn() => FilamentMenuBuilderPlugin::get()->getLocations())
->visible(fn () => FilamentMenuBuilderPlugin::get()->getLocations())
->label('Vị trí')
->helperText('Chọn vị trí hiển thị menu.')
->options(FilamentMenuBuilderPlugin::get()->getLocations()),
Expand Down
4 changes: 2 additions & 2 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

use BladeUI\Heroicons\BladeHeroiconsServiceProvider;
use BladeUI\Icons\BladeIconsServiceProvider;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderServiceProvider;
use Filament\Actions\ActionsServiceProvider;
use Filament\FilamentServiceProvider;
use Filament\Forms\FormsServiceProvider;
Expand All @@ -18,7 +19,6 @@
use Livewire\LivewireServiceProvider;
use Orchestra\Testbench\TestCase as Orchestra;
use RyanChandler\BladeCaptureDirective\BladeCaptureDirectiveServiceProvider;
use Datlechin\FilamentMenuBuilder\FilamentMenuBuilderServiceProvider;

class TestCase extends Orchestra
{
Expand All @@ -27,7 +27,7 @@ protected function setUp(): void
parent::setUp();

Factory::guessFactoryNamesUsing(
fn(string $modelName) => 'Datlechin\\FilamentMenuBuilder\\Database\\Factories\\' . class_basename($modelName) . 'Factory',
fn (string $modelName) => 'Datlechin\\FilamentMenuBuilder\\Database\\Factories\\' . class_basename($modelName) . 'Factory',
);
}

Expand Down

0 comments on commit 8da12ac

Please sign in to comment.