From 6042c5ad23782d3a7e52ce1f05b36c929aebb439 Mon Sep 17 00:00:00 2001 From: Daniel S Date: Sun, 9 Aug 2026 23:06:56 +0200 Subject: [PATCH] feat(editor): support individual section background colors per section in editor and components --- src/components/sections/BentoGrid.astro | 3 +- src/components/sections/ContactSection.astro | 3 +- src/components/sections/HeroSection.astro | 3 +- src/pages/admin/editor.astro | 49 ++++++++++++++++---- 4 files changed, 45 insertions(+), 13 deletions(-) diff --git a/src/components/sections/BentoGrid.astro b/src/components/sections/BentoGrid.astro index 7ce2f2a..7475d6c 100644 --- a/src/components/sections/BentoGrid.astro +++ b/src/components/sections/BentoGrid.astro @@ -8,7 +8,8 @@ interface Props { const { config } = Astro.props; --- -
+
+

{config.sectionTitle}

{config.sectionSubtitle}

diff --git a/src/components/sections/ContactSection.astro b/src/components/sections/ContactSection.astro index 5668b8e..69af488 100644 --- a/src/components/sections/ContactSection.astro +++ b/src/components/sections/ContactSection.astro @@ -9,7 +9,8 @@ interface Props { const { contactConfig, smtpConfig } = Astro.props; --- -
+
+

{contactConfig.title}

diff --git a/src/components/sections/HeroSection.astro b/src/components/sections/HeroSection.astro index c70a2b8..2f2e445 100644 --- a/src/components/sections/HeroSection.astro +++ b/src/components/sections/HeroSection.astro @@ -19,10 +19,11 @@ const actionElements = elements.filter((el: UIComponent) => el.slotId === 'hero- const customElements = elements.filter((el: UIComponent) => !el.slotId || el.slotId === 'hero-custom-slot'); --- -
+
+
diff --git a/src/pages/admin/editor.astro b/src/pages/admin/editor.astro index 4779396..359d06d 100644 --- a/src/pages/admin/editor.astro +++ b/src/pages/admin/editor.astro @@ -295,21 +295,50 @@ const previewUrl = `${targetPage?.slug || '/'}?preview=draft`; if (fieldsContainer) { fieldsContainer.innerHTML = ''; - Object.entries(currentSettings).forEach(([key, value]) => { + const allKeys = new Set(Object.keys(currentSettings)); + if (!allKeys.has('bg_color')) { + allKeys.add('bg_color'); + } + + allKeys.forEach((key) => { + const value = currentSettings[key] || ''; const fieldWrapper = document.createElement('div'); - fieldWrapper.innerHTML = ` - - - `; + + if (key === 'bg_color') { + fieldWrapper.innerHTML = ` + +
+ + +
+ `; + } else { + fieldWrapper.innerHTML = ` + + + `; + } fieldsContainer.appendChild(fieldWrapper); }); } + editModal?.showModal(); }); });