"use client";
import { BLOCK_KEY_PREFIX, getBlocksByCategory } from "@/lib/theme-blocks";
import { ColorField } from "./color-field";
import {
COLOR_FIELDS,
EFFECT_FIELDS,
getVal,
LAYOUT_FIELDS,
MEDIA_FIELDS,
type ScopeValues,
} from "./theme-editor-fields";
// ─── Colors Tab ──────────────────────────────────────────────────────────────
export function ColorsTab({
values,
mode,
}: {
values: ScopeValues;
mode: "light" | "dark";
}) {
return (
Colors ({mode} mode)
Only values you set here override the parent scope. Leave empty to
inherit.
{COLOR_FIELDS.map((field) => (
))}
);
}
// ─── Blocks Tab ──────────────────────────────────────────────────────────────
export function BlocksTab({ values }: { values: ScopeValues }) {
const grouped = getBlocksByCategory();
const categoryLabels: Record = {
chrome: "Site Chrome",
layout: "Layout",
components: "Components",
effects: "Effects",
};
return (
{Object.entries(grouped).map(([category, blocks]) => (
{categoryLabels[category] ?? category}
Toggle visibility of blocks in this scope. Hidden blocks use{" "}
display: none
.
{blocks.map((block) => {
const key = `${BLOCK_KEY_PREFIX}${block.id}`;
const currentVal = values.blocks[key];
const isChecked =
currentVal === "true" ||
(currentVal === undefined && block.defaultVisible);
return (
{block.label}
{block.description}
{block.selector}
);
})}
))}
);
}
// ─── Layout Tab ──────────────────────────────────────────────────────────────
export function LayoutTab({ values }: { values: ScopeValues }) {
return (
Layout Settings
Control spacing, width, and grid settings for this scope. Values are
applied as CSS custom properties.
{LAYOUT_FIELDS.map((field) => (
))}
);
}
// ─── Effects Tab ─────────────────────────────────────────────────────────────
export function EffectsTab({ values }: { values: ScopeValues }) {
return (
Effects & Transitions
Control shadows, borders, and animation timing for this scope.
{EFFECT_FIELDS.map((field) => (
))}
);
}
// ─── Media Tab ───────────────────────────────────────────────────────────────
export function MediaTab({ values }: { values: ScopeValues }) {
return (
Media & Backgrounds
Set custom logos, background images, and background properties for this
scope.
{MEDIA_FIELDS.map((field) => (
))}
);
}
// ─── Custom Tab ──────────────────────────────────────────────────────────────
export function CustomTab({ values }: { values: ScopeValues }) {
return (
Custom CSS
Add custom CSS that applies within this scope. Use{" "}
&{" "}
{" "}
as a placeholder for the scope selector (e.g.{" "}
& .content-card {"{"} border: 2px solid red; {"}"}
).
Custom HTML
Add custom HTML that injects into the page for this scope. Use for
custom banners, scripts, or content blocks.
);
}