From e907b1b6cb34dc3b5a865cdcfeddd007fa904c75 Mon Sep 17 00:00:00 2001 From: Benjamin Takats Date: Tue, 29 Nov 2022 21:31:45 +0100 Subject: [PATCH] force dark mode in Laravel Nova --- .gitignore | 1 + app/Providers/NovaServiceProvider.php | 11 ++++ composer.json | 3 +- config/nova.php | 21 ++++--- .../img/einundzwanzig-horizontal-inverted.svg | 1 + resources/img/einundzwanzig-horizontal.svg | 13 ++++ resources/views/vendor/nova/layout.blade.php | 60 +++++++++++++++++++ tailwind.config.js | 21 ++++++- 8 files changed, 118 insertions(+), 13 deletions(-) create mode 100644 resources/img/einundzwanzig-horizontal-inverted.svg create mode 100644 resources/img/einundzwanzig-horizontal.svg create mode 100644 resources/views/vendor/nova/layout.blade.php diff --git a/.gitignore b/.gitignore index 2853c34f..4d392b0e 100644 --- a/.gitignore +++ b/.gitignore @@ -15,3 +15,4 @@ yarn-error.log /.fleet /.idea /.vscode +auth.json diff --git a/app/Providers/NovaServiceProvider.php b/app/Providers/NovaServiceProvider.php index 96658c8a..78606ef6 100644 --- a/app/Providers/NovaServiceProvider.php +++ b/app/Providers/NovaServiceProvider.php @@ -15,10 +15,21 @@ class NovaServiceProvider extends NovaApplicationServiceProvider public function boot() { parent::boot(); + + Nova::withBreadcrumbs(); + + // disable theme switcher + Nova::withoutThemeSwitcher(); + // login with user id 1, if we are in local environment if (app()->environment('local')) { auth()->loginUsingId(1); } + + Nova::footer(function ($request) { + // return MIT license and date + return sprintf("%s %s - %s", date('Y'), config('app.name'), __('MIT License')); + }); } /** diff --git a/composer.json b/composer.json index 7e8c5fe7..20b5f33c 100644 --- a/composer.json +++ b/composer.json @@ -48,7 +48,8 @@ "@php artisan package:discover --ansi" ], "post-update-cmd": [ - "@php artisan vendor:publish --tag=laravel-assets --ansi --force" + "@php artisan vendor:publish --tag=laravel-assets --ansi --force", + "@php artisan nova:publish" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" diff --git a/config/nova.php b/config/nova.php index 8c9679b7..0f1930c8 100644 --- a/config/nova.php +++ b/config/nova.php @@ -148,7 +148,7 @@ return [ | */ - 'currency' => 'USD', + 'currency' => 'EUR', /* |-------------------------------------------------------------------------- @@ -162,15 +162,18 @@ return [ | */ - // 'brand' => [ - // 'logo' => resource_path('/img/example-logo.svg'), + 'brand' => [ + 'logo' => resource_path('/img/einundzwanzig-horizontal-inverted.svg'), - // 'colors' => [ - // "400" => "24, 182, 155, 0.5", - // "500" => "24, 182, 155", - // "600" => "24, 182, 155, 0.75", - // ] - // ], + 'colors' => [ + "400" => "247, 147, 26, 0.5", // rgba(247, 147, 26, 1) + "500" => "247, 147, 26, 0.75", + "600" => "247, 147, 26, 1", + + // rgba(0, 180, 207, 1) + // rgba(21, 21, 21, 1) + ] + ], /* |-------------------------------------------------------------------------- diff --git a/resources/img/einundzwanzig-horizontal-inverted.svg b/resources/img/einundzwanzig-horizontal-inverted.svg new file mode 100644 index 00000000..7edf22ae --- /dev/null +++ b/resources/img/einundzwanzig-horizontal-inverted.svg @@ -0,0 +1 @@ + diff --git a/resources/img/einundzwanzig-horizontal.svg b/resources/img/einundzwanzig-horizontal.svg new file mode 100644 index 00000000..869b73f3 --- /dev/null +++ b/resources/img/einundzwanzig-horizontal.svg @@ -0,0 +1,13 @@ + + + + + + + diff --git a/resources/views/vendor/nova/layout.blade.php b/resources/views/vendor/nova/layout.blade.php new file mode 100644 index 00000000..6e31728d --- /dev/null +++ b/resources/views/vendor/nova/layout.blade.php @@ -0,0 +1,60 @@ + + + + + + + + + + @include('nova::partials.meta') + + + + + @if ($styles = \Laravel\Nova\Nova::availableStyles(request())) + + @foreach($styles as $asset) + + @endforeach + @endif + + + + + @inertia +
+
+
+
+ +
+
+ + + + + + + + + + @if ($scripts = \Laravel\Nova\Nova::availableScripts(request())) + + @foreach ($scripts as $asset) + + @endforeach + @endif + + + + + diff --git a/tailwind.config.js b/tailwind.config.js index d73aac22..4dfe3642 100644 --- a/tailwind.config.js +++ b/tailwind.config.js @@ -2,14 +2,29 @@ const defaultTheme = require('tailwindcss/defaultTheme') /** @type {import('tailwindcss').Config} */ module.exports = { - content: [ + content: [ './vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php', './vendor/laravel/jetstream/**/*.blade.php', './storage/framework/views/*.php', './resources/views/**/*.blade.php', ], darkMode: 'class', - theme: { + theme: { + colors: { + 'gray': { + DEFAULT: '#151515', + '50': '#AEAEAE', + '100': '#A4A4A4', + '200': '#8F8F8F', + '300': '#7B7B7B', + '400': '#676767', + '500': '#525252', + '600': '#3E3E3E', + '700': '#292929', + '800': '#151515', + '900': '#000000' + }, + }, extend: { fontFamily: { sans: [ @@ -19,7 +34,7 @@ module.exports = { }, }, }, - plugins: [ + plugins: [ require('@tailwindcss/forms'), require('@tailwindcss/typography') ],