From d68992ac5098d753206bbf43ee0f61b847c42f6b Mon Sep 17 00:00:00 2001 From: Fa-BRAIK Date: Sun, 23 Feb 2025 17:32:01 -0500 Subject: [PATCH 1/6] feat: add support for default font configuration in theme --- config/filament-dash-stack-theme.php | 5 +++++ resources/css/theme.css | 2 -- src/DashStackThemePlugin.php | 4 ++++ src/DashStackThemeServiceProvider.php | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 2 deletions(-) diff --git a/config/filament-dash-stack-theme.php b/config/filament-dash-stack-theme.php index 848202a..ef77b31 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..c63bec3 100644 --- a/src/DashStackThemeServiceProvider.php +++ b/src/DashStackThemeServiceProvider.php @@ -2,10 +2,12 @@ namespace Nuxtifyts\DashStackTheme; +use Filament\Support\Assets\Css; use Illuminate\Console\Command; use Nuxtifyts\DashStackTheme\Commands\FilamentDashStackThemeInstallCommand; use Spatie\LaravelPackageTools\Package; use Spatie\LaravelPackageTools\PackageServiceProvider; +use Filament\Support\Facades\FilamentAsset; class DashStackThemeServiceProvider extends PackageServiceProvider { @@ -23,6 +25,25 @@ public function configurePackage(Package $package): void ->hasCommands(...self::commandsClassStrings()); } + /** + * @return $this + */ + public function boot() + { + parent::boot(); + + 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> */ From acc55502c75e309d67649cc23a73851f95b13947 Mon Sep 17 00:00:00 2001 From: Fa-BRAIK Date: Sun, 23 Feb 2025 17:35:44 -0500 Subject: [PATCH 2/6] feat: add default font configuration note for the theme in README --- README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/README.md b/README.md index 933c108..09dbfef 100644 --- a/README.md +++ b/README.md @@ -74,9 +74,17 @@ return [ 'collapsible-navigation-groups' => false, 'breadcrumbs' => false, + + /** + * Nunito Sans is the default font for the theme. + */ + 'use-default-font' => true, ]; ``` +> **Note:** Default Theme for Dash Stack theme is [Nunito Sans](https://fonts.google.com/specimen/Nunito+Sans), +> In order to disable it, you need to publish the config file, and set `use-default-font` to `false`. + Upcoming Features - From 33f5921f3098d2ee64a607173190a684782c4de3 Mon Sep 17 00:00:00 2001 From: Fa-BRAIK Date: Sun, 23 Feb 2025 17:37:33 -0500 Subject: [PATCH 3/6] feat: update README and service provider for default font configuration --- README.md | 8 -------- src/DashStackThemeServiceProvider.php | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/README.md b/README.md index 09dbfef..933c108 100644 --- a/README.md +++ b/README.md @@ -74,17 +74,9 @@ return [ 'collapsible-navigation-groups' => false, 'breadcrumbs' => false, - - /** - * Nunito Sans is the default font for the theme. - */ - 'use-default-font' => true, ]; ``` -> **Note:** Default Theme for Dash Stack theme is [Nunito Sans](https://fonts.google.com/specimen/Nunito+Sans), -> In order to disable it, you need to publish the config file, and set `use-default-font` to `false`. - Upcoming Features - diff --git a/src/DashStackThemeServiceProvider.php b/src/DashStackThemeServiceProvider.php index c63bec3..b9f7bea 100644 --- a/src/DashStackThemeServiceProvider.php +++ b/src/DashStackThemeServiceProvider.php @@ -3,11 +3,11 @@ 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; use Spatie\LaravelPackageTools\PackageServiceProvider; -use Filament\Support\Facades\FilamentAsset; class DashStackThemeServiceProvider extends PackageServiceProvider { @@ -37,7 +37,7 @@ public function boot() 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' - ) + ), ]); } From ad0c3c4b3a304321dc6b6a2c68be1a157a1bece6 Mon Sep 17 00:00:00 2001 From: Fa-BRAIK Date: Sun, 23 Feb 2025 17:39:53 -0500 Subject: [PATCH 4/6] feat: implement default font booting in DashStackThemeServiceProvider --- src/DashStackThemeServiceProvider.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/DashStackThemeServiceProvider.php b/src/DashStackThemeServiceProvider.php index b9f7bea..2eff779 100644 --- a/src/DashStackThemeServiceProvider.php +++ b/src/DashStackThemeServiceProvider.php @@ -30,8 +30,12 @@ public function configurePackage(Package $package): void */ public function boot() { - parent::boot(); + return parent::boot() + ->bootDefaultFont(); + } + protected function bootDefaultFont(): static + { if (config('filament-dash-stack-theme.use-default-font')) { FilamentAsset::register([ Css::make( @@ -40,7 +44,7 @@ public function boot() ), ]); } - + return $this; } From 0d0e3782cbf3df7280eba0c191b1db579b5b2c01 Mon Sep 17 00:00:00 2001 From: Fa-BRAIK Date: Sun, 23 Feb 2025 17:40:43 -0500 Subject: [PATCH 5/6] Lint fix --- src/DashStackThemeServiceProvider.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DashStackThemeServiceProvider.php b/src/DashStackThemeServiceProvider.php index 2eff779..d115273 100644 --- a/src/DashStackThemeServiceProvider.php +++ b/src/DashStackThemeServiceProvider.php @@ -44,7 +44,7 @@ protected function bootDefaultFont(): static ), ]); } - + return $this; } From 6f0f6d2fcdbc0efdaed88ab2699262b5ca86fc02 Mon Sep 17 00:00:00 2001 From: Fa-BRAIK Date: Sun, 23 Feb 2025 17:44:27 -0500 Subject: [PATCH 6/6] Fix lint on php 8.4 --- config/filament-dash-stack-theme.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/config/filament-dash-stack-theme.php b/config/filament-dash-stack-theme.php index ef77b31..57db8d2 100644 --- a/config/filament-dash-stack-theme.php +++ b/config/filament-dash-stack-theme.php @@ -13,7 +13,7 @@ 'breadcrumbs' => false, - /** + /** * Nunito Sans is the default font for the theme. */ 'use-default-font' => true,