Skip to content

Commit 8eb0b52

Browse files
committed
Refactor buttons on menu tree item
1 parent 1fed2ac commit 8eb0b52

File tree

2 files changed

+53
-5
lines changed

2 files changed

+53
-5
lines changed

CLAUDE.md

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,25 @@ The menu builder is partially implemented with the following components:
114114
],
115115
```
116116

117+
## Development Guidelines
118+
119+
### Use Existing Filament Components
120+
**IMPORTANT**: Always use existing Filament blade components and patterns instead of implementing custom HTML/CSS solutions.
121+
122+
- Use `<x-filament::button>` instead of custom button HTML
123+
- Use `<x-filament::badge>` instead of custom badge styling
124+
- Use `<x-filament::icon>` for consistent icon rendering
125+
- Use Filament's built-in form components and actions
126+
- Use Filament's existing patterns for modals, notifications, and UI elements
127+
- Leverage Filament's color system, sizing, and theming capabilities
128+
129+
This ensures:
130+
- Consistent styling across the application
131+
- Automatic theme support (light/dark mode)
132+
- Built-in accessibility features
133+
- Future compatibility with Filament updates
134+
- Reduced maintenance overhead
135+
117136
## Common Development Patterns
118137

119138
When extending this package:
@@ -122,4 +141,5 @@ When extending this package:
122141
3. Use the facade `FilamentFlexibleContentBlockPages` to access configuration
123142
4. SEO handling follows a fallback pattern: page SEO → hero image → default settings
124143
5. Route generation uses the configured route helper class
125-
6. Menu items follow the linkable pattern for polymorphic relationships
144+
6. Menu items follow the linkable pattern for polymorphic relationships
145+
7. **Always prefer existing Filament components over custom implementations**

resources/views/livewire/menu-tree-item.blade.php

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,13 +51,41 @@ class="mr-2 p-1 text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 trans
5151

5252
@if($showActions)
5353
<!-- Actions -->
54-
<div class="flex items-center space-x-2 opacity-0 group-hover:opacity-100 transition-opacity">
54+
<div class="flex items-center space-x-1 opacity-0 group-hover:opacity-100 transition-opacity">
5555
@if($this->canHaveChildren())
56-
{{ ($this->addChildAction)(['color' => 'gray']) }}
56+
<x-filament::button
57+
color="gray"
58+
size="xs"
59+
wire:click="mountAction('addChild')"
60+
>
61+
<x-slot name="icon">
62+
heroicon-o-plus
63+
</x-slot>
64+
{{ flexiblePagesTrans('menu_items.tree.add_child') }}
65+
</x-filament::button>
5766
@endif
5867

59-
{{ ($this->editAction)(['color' => 'primary']) }}
60-
{{ ($this->deleteAction)(['color' => 'danger']) }}
68+
<x-filament::button
69+
color="primary"
70+
size="xs"
71+
wire:click="mountAction('edit')"
72+
>
73+
<x-slot name="icon">
74+
heroicon-o-pencil
75+
</x-slot>
76+
{{ flexiblePagesTrans('menu_items.tree.edit') }}
77+
</x-filament::button>
78+
79+
<x-filament::button
80+
color="danger"
81+
size="xs"
82+
wire:click="mountAction('delete')"
83+
>
84+
<x-slot name="icon">
85+
heroicon-o-trash
86+
</x-slot>
87+
{{ flexiblePagesTrans('menu_items.tree.delete') }}
88+
</x-filament::button>
6189
</div>
6290
@endif
6391
</div>

0 commit comments

Comments
 (0)