Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
mansoorkhan96 committed Mar 21, 2024
1 parent 1a9ffec commit 9327021
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

Unsplash gallery for Filament. Search and pick any image from Unsplash.com, specify which size to use.

![](./screenshot.jpg)
![](./screenshot.jpeg)

## Installation

Expand Down
Binary file added screenshot.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed screenshot.jpg
Binary file not shown.
16 changes: 15 additions & 1 deletion src/Actions/UnsplashPickerAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ protected function setUp(): void

$this->modalWidth(fn (MountableAction $action): ?MaxWidth => MaxWidth::ScreenLarge);

$this->modalContent(fn () => new HtmlString(Blade::render("@livewire('unsplash-picker-component', ['perPage' => {$this->perPage}])")));
$this->modalContent(fn () => new HtmlString(Blade::render("@livewire('unsplash-picker-component', {$this->getOptions()})")));

$this->action($this->uploadImage(...));
}
Expand Down Expand Up @@ -122,4 +122,18 @@ protected function getImageSize(): ImageSize
{
return $this->imageSize ?? ImageSize::Regular;
}

protected function getPerPage(): ?int
{
return $this->perPage;
}

protected function getOptions()
{
if (! $this->getPerPage()) {
return;
}

return "['perPage' => {$this->getPerPage()}]";
}
}
2 changes: 0 additions & 2 deletions src/Components/UnsplashPickerComponent.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ public function nextPageAction(): Action
return Action::make('nextPage')
->button()
->label(__('unsplash-picker::unsplash-picker.next'))
->color('gray')
->disabled(fn () => $this->totalPages <= 1 || $this->page === $this->totalPages)
->action(function () {
$this->nextPage();
Expand All @@ -73,7 +72,6 @@ public function previousPageAction(): Action
{
return Action::make('previousPage')
->button()
->color('gray')
->label(__('unsplash-picker::unsplash-picker.previous'))
->disabled(fn () => $this->totalPages <= 1 || $this->page === 1)
->action(function () {
Expand Down

0 comments on commit 9327021

Please sign in to comment.