diff --git a/config/filament-dash-stack-theme.php b/config/filament-dash-stack-theme.php index 848202a..57db8d2 100644 --- a/config/filament-dash-stack-theme.php +++ b/config/filament-dash-stack-theme.php @@ -12,4 +12,9 @@ 'collapsible-navigation-groups' => false, 'breadcrumbs' => false, + + /** + * Nunito Sans is the default font for the theme. + */ + 'use-default-font' => true, ]; diff --git a/resources/css/theme.css b/resources/css/theme.css index 4ff3255..24669c5 100644 --- a/resources/css/theme.css +++ b/resources/css/theme.css @@ -1,11 +1,9 @@ -@import url('https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap'); @import '/vendor/filament/filament/resources/css/theme.css'; @import 'login.css'; @config 'tailwind.config.js'; :root { - --font-family: 'Nunito Sans', sans-serif !important; --ds-dark-bg-primary-color: #1B2431; --ds-dark-bg-secondary-color: #273142; --ds-dark-bg-tertiary-color: #323D4E; diff --git a/src/DashStackThemePlugin.php b/src/DashStackThemePlugin.php index b7ad8c8..33dab73 100644 --- a/src/DashStackThemePlugin.php +++ b/src/DashStackThemePlugin.php @@ -27,6 +27,10 @@ public function register(Panel $panel): void ->collapsibleNavigationGroups(config('filament-dash-stack-theme.collapsible-navigation-groups')) ->breadcrumbs(config('filament-dash-stack-theme.breadcrumbs')) ->viteTheme('vendor/nuxtifyts/dash-stack-theme/resources/css/theme.css'); + + if (config('filament-dash-stack-theme.use-default-font')) { + $panel->font('Nunito Sans'); + } } public function boot(Panel $panel): void diff --git a/src/DashStackThemeServiceProvider.php b/src/DashStackThemeServiceProvider.php index 918bd84..d115273 100644 --- a/src/DashStackThemeServiceProvider.php +++ b/src/DashStackThemeServiceProvider.php @@ -2,6 +2,8 @@ namespace Nuxtifyts\DashStackTheme; +use Filament\Support\Assets\Css; +use Filament\Support\Facades\FilamentAsset; use Illuminate\Console\Command; use Nuxtifyts\DashStackTheme\Commands\FilamentDashStackThemeInstallCommand; use Spatie\LaravelPackageTools\Package; @@ -23,6 +25,29 @@ public function configurePackage(Package $package): void ->hasCommands(...self::commandsClassStrings()); } + /** + * @return $this + */ + public function boot() + { + return parent::boot() + ->bootDefaultFont(); + } + + protected function bootDefaultFont(): static + { + if (config('filament-dash-stack-theme.use-default-font')) { + FilamentAsset::register([ + Css::make( + id: 'dash-stack-theme-font', + path: 'https://fonts.googleapis.com/css2?family=Nunito+Sans:ital,opsz,wght@0,6..12,200..1000;1,6..12,200..1000&family=Open+Sans:ital,wght@0,300..800;1,300..800&display=swap' + ), + ]); + } + + return $this; + } + /** * @return list> */