Initial commit
This commit is contained in:
112
editor/config/root.tsx
Normal file
112
editor/config/root.tsx
Normal file
@@ -0,0 +1,112 @@
|
||||
import { DefaultRootProps, RootConfig } from "@reacteditor/core";
|
||||
import { createFieldGoogleFonts } from "@reacteditor/field-google-fonts";
|
||||
import { ThemeProvider, ThemeProps } from "@/editor/theme/ThemeProvider";
|
||||
|
||||
export type RootProps = DefaultRootProps &
|
||||
ThemeProps & {
|
||||
description?: string;
|
||||
ogImage?: string;
|
||||
};
|
||||
|
||||
const headerFontField = createFieldGoogleFonts() as any;
|
||||
const bodyFontField = createFieldGoogleFonts() as any;
|
||||
|
||||
export const Root: RootConfig<{
|
||||
props: RootProps;
|
||||
fields: {
|
||||
userField: { type: "userField"; option: boolean };
|
||||
};
|
||||
}> = {
|
||||
defaultProps: {
|
||||
title: "Untitled",
|
||||
headerFont: "Inter",
|
||||
bodyFont: "Inter",
|
||||
// Hex defaults so the color picker reads them and any non-picker
|
||||
// input (typed hex, AI-set value, etc.) is round-trip compatible.
|
||||
primaryColor: "#0a0a0a",
|
||||
accentColor: "#f5f5f5",
|
||||
bgColor: "#ffffff",
|
||||
fgColor: "#0a0a0a",
|
||||
mutedColor: "#f5f5f5",
|
||||
roundedness: "md",
|
||||
shadowLevel: "sm",
|
||||
maxWidth: "xl",
|
||||
},
|
||||
fields: {
|
||||
title: { label: "Page title", type: "text" },
|
||||
description: { label: "Description", type: "textarea" },
|
||||
ogImage: { label: "OG image URL", type: "text" },
|
||||
headerFont: { label: "Header font", ...headerFontField },
|
||||
bodyFont: { label: "Body font", ...bodyFontField },
|
||||
primaryColor: { label: "Primary color", type: "color", placeholder: "#0a0a0a" },
|
||||
accentColor: { label: "Accent color", type: "color", placeholder: "#f5f5f5" },
|
||||
bgColor: { label: "Background color", type: "color", placeholder: "#ffffff" },
|
||||
fgColor: { label: "Foreground color", type: "color", placeholder: "#0a0a0a" },
|
||||
mutedColor: { label: "Muted color", type: "color", placeholder: "#f5f5f5" },
|
||||
roundedness: {
|
||||
label: "Roundedness",
|
||||
type: "select",
|
||||
options: [
|
||||
{ label: "None", value: "none" },
|
||||
{ label: "Small", value: "sm" },
|
||||
{ label: "Medium", value: "md" },
|
||||
{ label: "Large", value: "lg" },
|
||||
{ label: "Extra large", value: "xl" },
|
||||
{ label: "Full (pill)", value: "full" },
|
||||
],
|
||||
},
|
||||
shadowLevel: {
|
||||
label: "Shadow level",
|
||||
type: "select",
|
||||
options: [
|
||||
{ label: "None", value: "none" },
|
||||
{ label: "Small", value: "sm" },
|
||||
{ label: "Medium", value: "md" },
|
||||
{ label: "Large", value: "lg" },
|
||||
{ label: "Extra large", value: "xl" },
|
||||
],
|
||||
},
|
||||
maxWidth: {
|
||||
label: "Max width",
|
||||
type: "select",
|
||||
options: [
|
||||
{ label: "Small", value: "sm" },
|
||||
{ label: "Medium", value: "md" },
|
||||
{ label: "Large", value: "lg" },
|
||||
{ label: "Extra large", value: "xl" },
|
||||
{ label: "2X large", value: "2xl" },
|
||||
{ label: "Full bleed", value: "full" },
|
||||
],
|
||||
},
|
||||
},
|
||||
render: ({
|
||||
children,
|
||||
headerFont,
|
||||
bodyFont,
|
||||
primaryColor,
|
||||
accentColor,
|
||||
bgColor,
|
||||
fgColor,
|
||||
mutedColor,
|
||||
roundedness,
|
||||
shadowLevel,
|
||||
}) => {
|
||||
return (
|
||||
<ThemeProvider
|
||||
headerFont={headerFont}
|
||||
bodyFont={bodyFont}
|
||||
primaryColor={primaryColor}
|
||||
accentColor={accentColor}
|
||||
bgColor={bgColor}
|
||||
fgColor={fgColor}
|
||||
mutedColor={mutedColor}
|
||||
roundedness={roundedness}
|
||||
shadowLevel={shadowLevel}
|
||||
>
|
||||
{children}
|
||||
</ThemeProvider>
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
export default Root;
|
||||
Reference in New Issue
Block a user