From fce651a618ca6d0d64fbcea757c3e0f582e1b437 Mon Sep 17 00:00:00 2001 From: lonkaars Date: Thu, 22 Apr 2021 12:35:53 +0200 Subject: beginnings of theme settings --- components/themes.tsx | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) create mode 100644 components/themes.tsx (limited to 'components/themes.tsx') diff --git a/components/themes.tsx b/components/themes.tsx new file mode 100644 index 0000000..be98685 --- /dev/null +++ b/components/themes.tsx @@ -0,0 +1,61 @@ +import { useEffect, useState, CSSProperties } from 'react'; +import axios from 'axios'; + +import { userPreferences } from '../api/api'; +import { Button } from './ui'; + +type previewThemeColors = { + bg: string; + fg: string; + a: string; + b: string; +} + +export type themeInfo = { + name: string; + url: string; + dark: previewThemeColors; + light: previewThemeColors; +} + +export type themeJSON = themeInfo[]; + +export default function ThemePicker(props: { preferences?: userPreferences }) { + var [ themes, setThemes ] = useState([]); + + useEffect(() => { + axios.request({ + method: 'get', + url: '/themes/themes.json', + }).then(response => { + setThemes(response.data); + }).catch(err => { + console.error(err) + }) + }, []); + + return <> + {themes.map(theme => )} + ; +} + +export function ThemeCard(props: { theme: themeInfo; dark?: boolean }) { + var mode = props.dark ? "dark" : "light"; + + return
+ +
+} -- cgit v1.2.3