From 8df99d4c1ec86c58ad6bc40888ba51958e3a2e21 Mon Sep 17 00:00:00 2001
From: caroluchoa <43659990+caroluchoa@users.noreply.github.com>
Date: Mon, 8 Apr 2024 13:07:31 -0300
Subject: [PATCH] Update theme preview to new UI
---
sections/Theme/Theme.tsx | 532 ++++++++++++++++++++++++++-------------
1 file changed, 358 insertions(+), 174 deletions(-)
diff --git a/sections/Theme/Theme.tsx b/sections/Theme/Theme.tsx
index 6470442..bc69be5 100644
--- a/sections/Theme/Theme.tsx
+++ b/sections/Theme/Theme.tsx
@@ -6,6 +6,7 @@
*/
import SiteTheme, { Font } from "apps/website/components/Theme.tsx";
import Color from "npm:colorjs.io";
+import type { ComponentChildren } from "preact";
export interface ThemeColors {
/**
@@ -121,14 +122,19 @@ export interface Miscellaneous {
export interface Props {
/**
* @description Set the prefers-color-scheme media query. To support dark mode, create two instances of this block and set this option to light/dark in each instance
+ * @default light
*/
- colorScheme: "any" | "light" | "dark";
+ colorScheme?: "light" | "dark";
mainColors?: ThemeColors;
/** @description These will be auto-generated to a readable color if not set */
complementaryColors?: ComplementaryColors;
buttonStyle?: Button;
otherStyles?: Miscellaneous;
font?: Font;
+ /**
+ * @description This is the admin's color-scheme mode
+ */
+ mode?: "light" | "dark";
}
type Theme =
@@ -265,190 +271,131 @@ function Section({
);
}
export function Preview(props: Props) {
+ const adminColorMode = props.mode === "dark" ? "dark" : "light";
return (
<>
+ {
+ /* This stylesheet is used to simulate the colors from the admin's color schema (admin's light or dark mode), which are not accessible in the site's color schema.
+ * This is a temporary solution until the admin's color schema is accessible.
+ * TODO(@carol): Change this temporary solution / discuss with designers a doable approach
+ */
+ }
+
-