From 46f70e6a5ea7d638203946ba0b20454d1494ca63 Mon Sep 17 00:00:00 2001 From: Felix Roos Date: Fri, 10 Feb 2023 12:54:15 +0100 Subject: [PATCH] persisted theme + add all settings --- website/src/components/HeadCommon.astro | 38 +-- website/src/repl/Footer.jsx | 28 +-- website/src/repl/Header.jsx | 4 +- website/src/repl/Repl.jsx | 8 +- website/src/repl/themes.mjs | 319 +++++++++++++++++++++++- 5 files changed, 342 insertions(+), 55 deletions(-) diff --git a/website/src/components/HeadCommon.astro b/website/src/components/HeadCommon.astro index b1f948d4..22828f26 100644 --- a/website/src/components/HeadCommon.astro +++ b/website/src/components/HeadCommon.astro @@ -1,6 +1,7 @@ --- import { pwaInfo } from 'virtual:pwa-info'; import '../styles/index.css'; +import { settings } from '../repl/themes.mjs'; const { BASE_URL } = import.meta.env; const base = BASE_URL; @@ -29,33 +30,32 @@ const base = BASE_URL; {pwaInfo && } - diff --git a/website/src/repl/Footer.jsx b/website/src/repl/Footer.jsx index 898722f9..f2f6f304 100644 --- a/website/src/repl/Footer.jsx +++ b/website/src/repl/Footer.jsx @@ -55,8 +55,8 @@ export function Footer({ context }) {
setActiveFooter(name)} className={cx( - 'h-8 px-2 text-white cursor-pointer hover:text-tertiary flex items-center space-x-1 border-b', - activeFooter === name ? 'border-white hover:border-tertiary' : 'border-transparent', + 'h-8 px-2 text-foreground cursor-pointer hover:text-tertiary flex items-center space-x-1 border-b', + activeFooter === name ? 'border-foreground hover:border-tertiary' : 'border-transparent', )} > {label || name} @@ -78,7 +78,7 @@ export function Footer({ context }) {
{activeFooter !== '' && ( - )} @@ -173,31 +173,19 @@ export function Footer({ context }) {
{ - console.log(k, themeColors(t)); - setTheme(t); + setTheme(k); document.dispatchEvent( new CustomEvent('strudel-theme', { - detail: { - // TODO: dynamic - background: '#21202e', - foreground: '#edecee', - caret: '#a277ff', - selection: '#3d375e7f', - selectionMatch: '#3d375e7f', - gutterBackground: '#21202e', - gutterForeground: '#edecee', - gutterBorder: 'transparent', - lineHighlight: '#a394f033', - }, + detail: k, }), ); }} > -
{k}
+
{k}
{themeColors(t).map((c, i) => (
diff --git a/website/src/repl/Header.jsx b/website/src/repl/Header.jsx index 0cf77dff..5d29d88f 100644 --- a/website/src/repl/Header.jsx +++ b/website/src/repl/Header.jsx @@ -49,7 +49,7 @@ export function Header({ context }) { className={cx( isEmbedded ? 'text-l cursor-pointer' : 'text-xl', // 'bg-clip-text bg-gradient-to-r from-primary to-secondary text-transparent font-bold', - 'text-white font-bold flex space-x-2 items-center', + 'text-foreground font-bold flex space-x-2 items-center', )} >
{!isZen && ( -
+