Extend the theme editor: typography, button/link colours, custom CSS, more presets
Grew /admin/theme from colours-only to a full theme editor, all applied live via website_settings + ThemeVars: - Typography: body font (10 web-safe + Google options; Google fonts load via an injected <link>) and H1/H2/H3 sizes (globals.css now reads --size-heading-* vars). - Buttons & links: secondary/danger button colours + link/link-hover. - Custom CSS: a raw textarea injected after the theme variables (staff- trusted), for anything the controls don't cover. - Presets: 6 → 13 (added Galaxy, Royal, Cyberpunk, Neon, Coffee, Arctic, Christmas). ThemeVars now injects all the new vars + the font link. Verified live (prod, amx_test): saved font=mono / H1=44px / custom CSS → the public home reflected --font-family "Courier New", --size-heading-h1 44px and the injected rule; reverted the test settings. tsc 0, vitest 49/49, next build 0.
This commit is contained in:
1 parent
0cd4d06ff6
commit
5a4b6f27e9
5 files changed
+322
-52
No files matched your search
@@ -1,6 +1,29 @@
|
||||
// Theme constants shared by the admin Theme page and its server action. Kept in
|
||||
// a plain module because a "use server" file may only export async functions.
|
||||
|
||||
// Selectable body fonts. Web-safe stacks render with no extra request; the few
|
||||
// Google fonts load via a <link> ThemeVars injects when chosen.
|
||||
export const FONTS: Record<string, { label: string; stack: string; google?: string }> = {
|
||||
nunito: { label: "Nunito (default)", stack: 'var(--font-nunito), "Nunito", sans-serif' },
|
||||
system: { label: "System", stack: 'ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif' },
|
||||
inter: {
|
||||
label: "Inter",
|
||||
stack: '"Inter", sans-serif',
|
||||
google: "Inter:wght@400;600;700;800",
|
||||
},
|
||||
poppins: {
|
||||
label: "Poppins",
|
||||
stack: '"Poppins", sans-serif',
|
||||
google: "Poppins:wght@400;600;700;800",
|
||||
},
|
||||
roboto: { label: "Roboto", stack: '"Roboto", sans-serif', google: "Roboto:wght@400;500;700" },
|
||||
georgia: { label: "Georgia (serif)", stack: 'Georgia, "Times New Roman", serif' },
|
||||
trebuchet: { label: "Trebuchet", stack: '"Trebuchet MS", Verdana, sans-serif' },
|
||||
verdana: { label: "Verdana", stack: "Verdana, Geneva, sans-serif" },
|
||||
comic: { label: "Comic (retro)", stack: '"Comic Sans MS", "Comic Sans", cursive' },
|
||||
mono: { label: "Monospace", stack: '"Courier New", ui-monospace, monospace' },
|
||||
};
|
||||
|
||||
// The colour settings ThemeVars injects into :root. Editing these recolours the
|
||||
// whole site live (ThemeVars reads them on every request).
|
||||
export const THEME_COLOR_KEYS = [
|
||||
@@ -105,4 +128,102 @@ export const PRESETS: Record<string, Record<string, string>> = {
|
||||
button_text_color: "#ffffff",
|
||||
border_color: "#f472b6",
|
||||
},
|
||||
Galaxy: {
|
||||
color_primary: "#a855f7",
|
||||
color_background: "#0b0a1f",
|
||||
color_surface: "#171430",
|
||||
color_dropdown: "#211d44",
|
||||
color_navbar: "#171430",
|
||||
color_navbar_text: "#e9e5ff",
|
||||
color_text: "#e9e5ff",
|
||||
color_text_muted: "#a39dcf",
|
||||
color_accent: "#22d3ee",
|
||||
button_primary_color: "#a855f7",
|
||||
button_text_color: "#ffffff",
|
||||
border_color: "#7c3aed",
|
||||
},
|
||||
Royal: {
|
||||
color_primary: "#4f46e5",
|
||||
color_background: "#f5f6ff",
|
||||
color_surface: "#ffffff",
|
||||
color_dropdown: "#ffffff",
|
||||
color_navbar: "#ffffff",
|
||||
color_navbar_text: "#1e1b4b",
|
||||
color_text: "#1e1b4b",
|
||||
color_text_muted: "#636681",
|
||||
color_accent: "#d97706",
|
||||
button_primary_color: "#4f46e5",
|
||||
button_text_color: "#ffffff",
|
||||
border_color: "#818cf8",
|
||||
},
|
||||
Cyberpunk: {
|
||||
color_primary: "#f0db4f",
|
||||
color_background: "#0d0221",
|
||||
color_surface: "#190933",
|
||||
color_dropdown: "#241046",
|
||||
color_navbar: "#190933",
|
||||
color_navbar_text: "#f0db4f",
|
||||
color_text: "#f5e9ff",
|
||||
color_text_muted: "#b08fd6",
|
||||
color_accent: "#ff2a6d",
|
||||
button_primary_color: "#ff2a6d",
|
||||
button_text_color: "#ffffff",
|
||||
border_color: "#05d9e8",
|
||||
},
|
||||
Neon: {
|
||||
color_primary: "#39ff14",
|
||||
color_background: "#0a0a0a",
|
||||
color_surface: "#141414",
|
||||
color_dropdown: "#1d1d1d",
|
||||
color_navbar: "#141414",
|
||||
color_navbar_text: "#39ff14",
|
||||
color_text: "#e8ffe8",
|
||||
color_text_muted: "#7fae7f",
|
||||
color_accent: "#ff00ff",
|
||||
button_primary_color: "#39ff14",
|
||||
button_text_color: "#0a0a0a",
|
||||
border_color: "#39ff14",
|
||||
},
|
||||
Coffee: {
|
||||
color_primary: "#a16207",
|
||||
color_background: "#f5efe6",
|
||||
color_surface: "#fffaf2",
|
||||
color_dropdown: "#fffaf2",
|
||||
color_navbar: "#fffaf2",
|
||||
color_navbar_text: "#3f2d1c",
|
||||
color_text: "#3f2d1c",
|
||||
color_text_muted: "#8a7560",
|
||||
color_accent: "#15803d",
|
||||
button_primary_color: "#a16207",
|
||||
button_text_color: "#ffffff",
|
||||
border_color: "#ca8a04",
|
||||
},
|
||||
Arctic: {
|
||||
color_primary: "#0891b2",
|
||||
color_background: "#eef6fb",
|
||||
color_surface: "#ffffff",
|
||||
color_dropdown: "#ffffff",
|
||||
color_navbar: "#ffffff",
|
||||
color_navbar_text: "#0e3a4f",
|
||||
color_text: "#0e3a4f",
|
||||
color_text_muted: "#5b7585",
|
||||
color_accent: "#6366f1",
|
||||
button_primary_color: "#0891b2",
|
||||
button_text_color: "#ffffff",
|
||||
border_color: "#67e8f9",
|
||||
},
|
||||
Christmas: {
|
||||
color_primary: "#dc2626",
|
||||
color_background: "#f4faf4",
|
||||
color_surface: "#ffffff",
|
||||
color_dropdown: "#ffffff",
|
||||
color_navbar: "#0f3d24",
|
||||
color_navbar_text: "#ffffff",
|
||||
color_text: "#14321f",
|
||||
color_text_muted: "#5f7a68",
|
||||
color_accent: "#15803d",
|
||||
button_primary_color: "#dc2626",
|
||||
button_text_color: "#ffffff",
|
||||
border_color: "#16a34a",
|
||||
},
|
||||
};
|
||||
Reference in new issue
Block a user