Skip to content

Commit 25750ec

Browse files
scott graysonscott grayson
authored andcommitted
fix: implement proper icon spacing with custom HTML format
- Replace icon() method with formatStateUsing() for better control - Use custom HTML with flex layout and gap-2 for proper spacing - Icons now have consistent 4x4 size and proper colors - Green folder icons, gray document icons with proper padding
1 parent 21fe7ca commit 25750ec

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Resources/LibraryItemResource.php

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,14 +92,12 @@ public static function table(Table $table): Table
9292
Tables\Columns\TextColumn::make('name')
9393
->searchable()
9494
->sortable()
95-
->icon(fn (LibraryItem $record): string =>
96-
$record->type === 'folder' ? 'heroicon-o-folder' : 'heroicon-o-document'
97-
)
98-
->iconColor(fn (LibraryItem $record): string =>
99-
$record->type === 'folder' ? 'success' : 'gray'
100-
)
101-
->iconPosition('before')
102-
->extraAttributes(['class' => 'flex items-center gap-2']),
95+
->formatStateUsing(function (LibraryItem $record): string {
96+
$icon = $record->type === 'folder' ? 'heroicon-o-folder' : 'heroicon-o-document';
97+
$color = $record->type === 'folder' ? 'text-green-500' : 'text-gray-500';
98+
return "<div class='flex items-center gap-2'><x-heroicon-o-{$icon} class='w-4 h-4 {$color}' /><span>{$record->name}</span></div>";
99+
})
100+
->html(),
103101
Tables\Columns\TextColumn::make('creator.name')
104102
->label('Created By')
105103
->searchable()

0 commit comments

Comments
 (0)