diff --git a/Filament/Blocks/ImageSpatie.php b/Filament/Blocks/ImageSpatie.php index bdd2031e..05bdce94 100755 --- a/Filament/Blocks/ImageSpatie.php +++ b/Filament/Blocks/ImageSpatie.php @@ -4,10 +4,8 @@ namespace Modules\UI\Filament\Blocks; -use Filament\Forms; use Filament\Forms\Components\Builder\Block; use Filament\Forms\Components\Hidden; -use Filament\Forms\Components\Select; use Filament\Forms\Components\SpatieMediaLibraryFileUpload; use Filament\Forms\Components\TextInput; use Filament\Forms\Contracts\HasForms; @@ -27,22 +25,20 @@ public static function make( Hidden::make('img_uuid') ->default(fn () => Str::uuid()->toString()) ->formatStateUsing(fn ($state) => $state ?? Str::uuid()->toString()) - ->live(), - // ->required(), + // ->live() + , SpatieMediaLibraryFileUpload::make('image') ->live() ->hiddenLabel() - // ->imagePreviewHeight('250') + ->imagePreviewHeight('666') // ->panelLayout('integrated') - ->imageResizeMode('cover') - ->panelAspectRatio('2:1') + // ->imageResizeMode('cover') + // ->panelAspectRatio('2:1') ->maxSize(102400) ->disk('local') ->image() - // ->imageEditor() ->preserveFilenames() - // ->columnSpanFull() ->openable() ->downloadable() // ->rules(Rule::dimensions()->maxWidth(600)->maxHeight(800)) @@ -56,43 +52,10 @@ function (HasForms $livewire, SpatieMediaLibraryFileUpload $component, Temporary ->toMediaCollection($get('img_uuid')); } ), - /* - Select::make('ratio') - ->options(static::getRatios()) - ->afterStateHydrated(static fn ($state, $set) => $state || $set('ratio', '4-3')), - - TextInput::make('alt') - ->columnSpanFull(), - */ - TextInput::make('caption') - // ->columnSpanFull() - , - - // Filament\Forms\Components\SpatieMediaLibraryFileUpload::whereCustomProperties does not exist. - // ->whereCustomProperties(fn(Forms\Get $get) => ['gallery_id' => $get('gallery_id')]) - - // ->customProperties(fn(Forms\Get $get) => ['gallery_id' => $get('gallery_id')]), - // Forms\Components\SpatieMediaLibraryFileUpload::make('media_id') + TextInput::make('caption'), ]) - ->columns('form' === $context ? 2 : 1); - } - - public static function getRatios(): array - { - return [ - '4-3' => '4/3', - '3-4' => '3/4', - 'free' => 'free', - ]; - } - - public static function getRatioClass(string $ratio): string - { - return match ($ratio) { - '4-3' => 'aspect-[4/3]', - '3-4' => 'aspect-[3/4]', - default => '', - }; + ->columns('form' === $context ? 2 : 1) + ; } }