Skip to content

Commit

Permalink
fix: assets registration
Browse files Browse the repository at this point in the history
Signed-off-by: Lukas Frey <[email protected]>
  • Loading branch information
lukas-frey committed Jul 15, 2024
1 parent 4e398a9 commit 1906d71
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 13 deletions.
13 changes: 0 additions & 13 deletions src/CalendarPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,6 @@ public function register(Panel $panel): void

public function boot(Panel $panel): void
{
Livewire::component('calendar-widget', CalendarWidget::class);

FilamentAsset::register(
assets: [
AlpineComponent::make(
'calendar-widget',
__DIR__ . '/../dist/js/calendar-widget.js',
),
Css::make('calendar-styles', 'https://cdn.jsdelivr.net/npm/@event-calendar/[email protected]/event-calendar.min.css'),
Js::make('calendar-script', 'https://cdn.jsdelivr.net/npm/@event-calendar/[email protected]/event-calendar.min.js'),
],
package: 'guava/calendar'
);
}

public static function make(): static
Expand Down
23 changes: 23 additions & 0 deletions src/CalendarServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@

namespace Guava\Calendar;

use Filament\Support\Assets\AlpineComponent;
use Filament\Support\Assets\Css;
use Filament\Support\Assets\Js;
use Filament\Support\Facades\FilamentAsset;
use Guava\Calendar\Widgets\CalendarWidget;
use Livewire\Livewire;
use Spatie\LaravelPackageTools\Package;
use Spatie\LaravelPackageTools\PackageServiceProvider;

Expand All @@ -20,4 +26,21 @@ public function configurePackage(Package $package): void
->hasViews()
;
}

public function packageBooted()
{
Livewire::component('calendar-widget', CalendarWidget::class);

FilamentAsset::register(
assets: [
AlpineComponent::make(
'calendar-widget',
__DIR__ . '/../dist/js/calendar-widget.js',
),
Css::make('calendar-styles', 'https://cdn.jsdelivr.net/npm/@event-calendar/[email protected]/event-calendar.min.css'),
Js::make('calendar-script', 'https://cdn.jsdelivr.net/npm/@event-calendar/[email protected]/event-calendar.min.js'),
],
package: 'guava/calendar'
);
}
}

0 comments on commit 1906d71

Please sign in to comment.