Implemented a way for the developer to define a custom background color for the pages they are building through the config file 'pagebuilder.php'

This commit is contained in:
Helge-Mikael Nordgård 2025-05-06 11:04:24 +02:00
parent 2977468159
commit 3dd0c6080f
3 changed files with 17 additions and 1 deletions

View File

@ -3,6 +3,7 @@
namespace App\Providers; namespace App\Providers;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Inertia\Inertia; use Inertia\Inertia;
use App\Helpers\PageSettingsHelper; use App\Helpers\PageSettingsHelper;
@ -27,6 +28,9 @@ class AppServiceProvider extends ServiceProvider
'siteName' => function () { 'siteName' => function () {
return config('app.name'); return config('app.name');
}, },
'canvas' => function () {
return config('pagebuilder.canvas');
}
]); ]);
} }
} }

11
config/pagebuilder.php Normal file
View File

@ -0,0 +1,11 @@
<?php
/**
* PageBuilder specific settings
* =============================
*
*/
return [
'canvas' => 'bg-black' // The main background color of the pagebuilder canvas (the background color of the pages you want to build)
];

View File

@ -39,6 +39,7 @@
const showMainMenu = ref(false); const showMainMenu = ref(false);
const page = usePage(); const page = usePage();
const pageRef = ref(); const pageRef = ref();
const canvasClass = page.props.canvas || 'bg-black'; // fallback to bg-black
/** Get a node value from json */ /** Get a node value from json */
@ -70,7 +71,7 @@
<template> <template>
<Head :title="revision.title" /> <Head :title="revision.title" />
<div ref="pageRef" class="min-h-screen w-full bg-black"> <div ref="pageRef" class="min-h-screen w-full" :class="canvasClass">
<!-- Komponentrendring --> <!-- Komponentrendring -->
<component <component
v-for="block in revision.content" v-for="block in revision.content"